This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

Find a service characteristics' handles

Hello,

I am implementing a custom service with several characteristics, one of which is the current temperature. A second characteristic notifies the user if the temperature is above a predefined level, so I would like this second characteristic to be able to read the temperature characteristic's value.

I can get the temperature value this way: ble_gatts_value_t test_value; sd_ble_gatts_value_get(p_my_service->conn_handle, 29, &test_value); uint16_t temperature_value = *(test_value.p_value);

The 29 is the temperature characteristic handle, which I found by debugging the program and reading the handle number when the characteristic was initialized. How do I find this value programmatically instead of hardcoding it? Thanks.

Other info: SDK 13.0 PCA10040 Eclipse 4.5.2

EDIT: Specifically I was trying to find the service characteristic handles on the server itself (more a problem of where data is stored than how the ble communication works). I just found a blog post that basically answers my question here

Related