This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Changing Characteristic Handle Value NRF52840 based on Tutorial

Hi,

I've been following this tutorial regarding connecting my BLE device to another Bluetooth module:

https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/getting-started/posts/ncs-ble-tutorial-part-1-custom-service-in-peripheral-role

Is there a way to change the characteristic handle value or is it all autogenerated and not possible to change this? I assume in order to configure the handle value it would be declared with BT_GATT_SERVICE_DEFINE(...) function however I haven't found any documentation regarding changing characteristic handle value without using SoftDevice functions. 

Kind regards,

Tyson

  • Hello,

    Edit: Let me look into this.

    Edit2: So after speaking with the developers this is what I have learned. The characteristic handles needs to be in sequentially order without holes in the sequence. If you use BT_GATT_SERVICE_DEFINE() they will be defined static and incrementally, however it should be possible to call bt_gatt_service_register() directly and if the handle is non-zero it will use that handle, so you can reserve room for specific characteristic handle, but there must be no holes in the sequence. So in short, if you call bt_gatt_service_register() first with the handles you want to set, and afterwards use BT_GATT_SERVICE_DEFINE() to fill in the holes that could work.

    Best regards,
    Kenneth

Related