Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

How to add multiple characteristics with different attributes?

My platform is nRF52832 and SDK v16.0.0 (SDK 17.1.0 is also an option).

I am able to add two characteristics to a newly added vendor specific 128-bit UUID. However, the only way to get this to succeed with no errors (i.e. no INVALID_PARAMS returned by the call to the Soft Device) is to provide identical attribute properties to the two characteristics.

Is my only option to create two different services and add characteristics to each one while setting up different attribute properties for those two characteristics?

Cheers

RMV

Parents
  • Hi

    I suggest using the ble_app_blinky example project as reference here. Basically, during initialization you have a services_init() function where you set up the services/characteristics you want your GATT server to contain. This is done by calling sd_ble_gatts_service_add() and sd_ble_gatts_characteristic_add(). It's important that when you initialize a characteristic, the support notification you buffer the char_handle with is added in the sd_ble_gatts_characteristic_add() actually returns, since this char_handle is required every time you want to send notification data.

    Best regards,

    Simon

Reply
  • Hi

    I suggest using the ble_app_blinky example project as reference here. Basically, during initialization you have a services_init() function where you set up the services/characteristics you want your GATT server to contain. This is done by calling sd_ble_gatts_service_add() and sd_ble_gatts_characteristic_add(). It's important that when you initialize a characteristic, the support notification you buffer the char_handle with is added in the sd_ble_gatts_characteristic_add() actually returns, since this char_handle is required every time you want to send notification data.

    Best regards,

    Simon

Children
Related