I am trying to code a cycle power service and I need to add a server characteristic configuration descriptor. This service is probably the only BT SIG service that uses that descriptor. I have a method that uses sd_* calls to add a characteristic to a service. But I did not add the option to include an sccd. So I thought I would call this method, and having the populated
ble_gatts_char_handles_t
structure, I would use the
sd_ble_gatts_descriptor_add(uint16_t char_handle, ble_gatts_attr_t const *p_attr, uint16_t *p_handle)
method to add the sccd. But I cannot figure out how to use this method and what it is expecting. Is the ble_gatts_attr_t structure the descriptor? So do I create this structure, populate it to the extent I can, and then use the fields in the ble_gatts_char_handles_t structure to populate the char_handle and *p_handle fields?
From the documentation I believe I have to make this call to add the descriptor right after I add the power characteristic to the service.
Or is the ble_gatts_attr_t structure the cycle power measurement characteristic itself? If so, I would need other ,methods to get the structure. My guess is that the ble_gatts_attr_t struct is supposed to be the descriptor itself, but that is certainly not clear from the documentation.