Adding predefined BLE service

eyalasko
Posts: 7
Joined: Sun Dec 08, 2019 7:09 am

Adding predefined BLE service

Postby eyalasko » Wed Jan 22, 2020 3:30 pm

Hi,

I wrote my own Nimble service and now would like to add some 'standardized' services (DIS & BAS)
I've noticed that the Nimble stack have these implemented under
%IDF_PATH%\components\bt\host\nimble\nimble\nimble\host\services\bas &
%IDF_PATH%\components\bt\host\nimble\nimble\nimble\host\services\dis

However, I have no idea how to manipulate the make/cmake/ninja files in order to include the relevant *.h & **.c files

I've tried to add

Code: Select all

#include "services/bas/ble_svc_bas.h"
#include "services/bas/ble_svc_dis.h"
and

Code: Select all

ble_svc_bas_init();
ble_svc_dis_init();
within gatt_svr_init(), however it does not build.

Any advise?

Thanks

eyalasko
Posts: 7
Joined: Sun Dec 08, 2019 7:09 am

Re: Adding predefined BLE service

Postby eyalasko » Thu Jan 23, 2020 2:49 pm

figured it it out. sort of.

With regard to BAS:
* add void ble_svc_bas_init(void) signature to ble_svc_bas.h

With regard to DIS:
* edit CMakeLists.txt in compoenets\bt and add the following to the CONFIG_BT_NIMBLE_ENABLED section:
- "host/nimble/nimble/nimble/host/services/dis/include" to the 'APPEND include_dirs' subsection
- "host/nimble/nimble/nimble/host/services/dis/src/ble_svc_dis.c" to the 'APPEND srcs' subsection

Now I can use initialize the services (ble_svc_dis_init(), ble_svc_bas_init()) however it fails to find DIS MYNEWT_VAL() declarations

Code: Select all

struct ble_svc_dis_data ble_svc_dis_data = {
    .model_number      = MYNEWT_VAL(BLE_SVC_DIS_MODEL_NUMBER_DEFAULT),
    .serial_number     = MYNEWT_VAL(BLE_SVC_DIS_SERIAL_NUMBER_DEFAULT),
    .firmware_revision = MYNEWT_VAL(BLE_SVC_DIS_FIRMWARE_REVISION_DEFAULT),
    .hardware_revision = MYNEWT_VAL(BLE_SVC_DIS_HARDWARE_REVISION_DEFAULT),
    .software_revision = MYNEWT_VAL(BLE_SVC_DIS_SOFTWARE_REVISION_DEFAULT),
    .manufacturer_name = MYNEWT_VAL(BLE_SVC_DIS_MANUFACTURER_NAME_DEFAULT),
};
How these can be configured ?

Thansk

neokim
Posts: 1
Joined: Tue Jan 19, 2021 9:55 am

Re: Adding predefined BLE service

Postby neokim » Tue Jan 19, 2021 10:01 am

Late response but I think you can refer to this PR for the issue.

Who is online

Users browsing this forum: ESP_Roland, Google [Bot] and 52 guests