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

read parameter is not updated if bluetooth is disconnected

we are making a pedometer. when you are connected, you get notification for every step you make (just an integer)

you just did 50 steps. you can see it in the app. now you disconnect. you continue to do some steps, maybe 15 steps. then you reconnect, but don't make new steps. the "read" should be 65. but the read is still 50. I need to make one more step to get a notification (66)

Any idea where this comes from ?

  • Hi

    What you need is to call the sd_ble_gatts_value_set() function every time you do a step, even though you are not connected. The sd_ble_gatts_value_set() updates the value in the database which is read when you perform a read from the central device. You can see an example of this in e.g. ble_app_hrs example in nRF51 SDK 9.0.0. The ble_bas_battery_level_update() function is called every time a new battery value is to be sent, and the database value is also updated with call to sd_ble_gatts_value_set

Related