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.

  • Yes, you can use it like this. Server will update characteristic value inside softdevice on write ond after this send BLE_GATTS_EVT_WRITE event to your application and you can store and use this value inside your application and don't get it with sd_ble_gatts_value_get() every time. You just need to handle BLE_GATTS_EVT_WRITE event and update your bool variable and as well update it if you call sd_ble_gatts_value_set() for this characteristic anywhere inside your application.

Reply
  • Yes, you can use it like this. Server will update characteristic value inside softdevice on write ond after this send BLE_GATTS_EVT_WRITE event to your application and you can store and use this value inside your application and don't get it with sd_ble_gatts_value_get() every time. You just need to handle BLE_GATTS_EVT_WRITE event and update your bool variable and as well update it if you call sd_ble_gatts_value_set() for this characteristic anywhere inside your application.

Children
No Data
Related