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

updating data between application layer and stack

Hello, I have some characteristics on my device that are containing some configuration data. Every single variable is a global variable. The values can also be changed manually by a keypad on the device. Is a sd_ble_gatts_value_set() call after every manual change, of any value, the prefered way of telling the BLE Stack, that there is a new value? Or is there any other efficient way?

Thanks

Regards, BTprogrammer

Parents
  • Hello.

    The sd_ble_gatts_value_set function will set a new value in the local memory of your device. It will not send this value to a client connected to it. If the client does a read on that characteristic, he will get this new value.

    If you do a notification with sd_ble_gatts_hvx, it will update the local value, as well as send it to the client.

    If you want to learn more about BLE and our SDK / softdevice, please see the tutorial section and youtube channel. You can also read guides on other sites to gain more understanding as well.

Reply
  • Hello.

    The sd_ble_gatts_value_set function will set a new value in the local memory of your device. It will not send this value to a client connected to it. If the client does a read on that characteristic, he will get this new value.

    If you do a notification with sd_ble_gatts_hvx, it will update the local value, as well as send it to the client.

    If you want to learn more about BLE and our SDK / softdevice, please see the tutorial section and youtube channel. You can also read guides on other sites to gain more understanding as well.

Children
  • Hello Anders, thanks for you answer, yes thats clear, I only want that the new value is available for the connected peer if a read is done. I notification isn`t needed in these cases. But I have to "manually" update the new values to the softdevice right? My question was just if there is maybe another, more efficient way to update these values. For example the softdevice look automatically for changes or something like this. Regards, BTprogrammer

  • Yes, you must use this function to update the value of the characteristic.