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

access characteristic value

I have writable characteristic on the server. As far as I understood there are at least two ways to access to its value: one using ble_evt_t and BLE_GATTS_EVT_WRITE another via function sd_ble_gatts_value_get(). Please advise when and how to choose between those options.

Thank you.

Parents
  • BLE_GATTS_EVT_WRITE event will be generated when client will write some data in this characteristic, after this value was received server will save this value as current characteristic value.

    With sd_ble_gatts_value_get() call you can get current characteristic value at any time and place you want.

  • OK, let's take another look. If the server will update the value of this characteristic on write event and then will access to it without using sd_ble_gatts_value_get(). This looks easier but is it kosher? From other hand sd_ble_gatts_value_get() will probably take more effort to access every time it's needed but may be more legit. The characteristic I have in mind is bool and I don't feel comfortable using sd_ble_gatts_value_get(0 every time instead of if.

Reply
  • OK, let's take another look. If the server will update the value of this characteristic on write event and then will access to it without using sd_ble_gatts_value_get(). This looks easier but is it kosher? From other hand sd_ble_gatts_value_get() will probably take more effort to access every time it's needed but may be more legit. The characteristic I have in mind is bool and I don't feel comfortable using sd_ble_gatts_value_get(0 every time instead of if.

Children
No Data
Related