This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to get Handle of CCCD

Hello,

I have build a gatt server device and my application is setup following the tutorials, which are really helpful by the way.

Now I want to check if the notifications are enabled or not. After search in the dev zone I found that i must use the sd_ble_gatts_value_get function. The problem is that it needs the handle of the cccd as an input argument. I have saved all services handles and each characteristic handle as the tutorials recommended. but I cannot find a cccd handle being returned anywhere.

Any suggestions?

Parents
  • It's per-characteristic - so it's one of the handles returned when you add the characteristic with sd_ble_gatts_characteristic_add. See the ble_gatts_char_handles_t structure.

    Normally you use the event which tells you a handle has been written to capture the write to the CCCD instead of reading it later, however you still need the handle for that so you still need to know where to find it.

Reply
  • It's per-characteristic - so it's one of the handles returned when you add the characteristic with sd_ble_gatts_characteristic_add. See the ble_gatts_char_handles_t structure.

    Normally you use the event which tells you a handle has been written to capture the write to the CCCD instead of reading it later, however you still need the handle for that so you still need to know where to find it.

Children
Related