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

How to use BLE_GATTS_VLOC_USER ?

Do I still have to call sd_ble_gatts_value_set() on the characteristic handle [using whatever temporary buffer I would have been using anyway for BLE_GATTS_VLOC_STACK]?

Or can I simply modify the referenced buffer, and characteristic reads will magically start returning the updated buffer value? (I am not using rd_auth for characteristic reads; the ble_gatts_attr_md_t for the characteristic has rd_auth=0.)

Thanks!

Parents
  • Ah, I understand the problem with variable-length attributes, so things would break without rd_auth.

    So if variable-length attributes are being used with VLOC_USER, then sd_ble_gatts_value_set() must be called? If the characteristic value is large, is there any way to avoid the memcpy penalty in sd_ble_gatts_value_set()?

    Would it be OK to call sd_ble_gatts_value_set() with the correct p_len, but then to specify a NULL p_value (since the value is VLOC_USER)? That should satisfy the softdevice bookkeeping for variable-length attributes without actually unnecessarily copying data around?

Reply
  • Ah, I understand the problem with variable-length attributes, so things would break without rd_auth.

    So if variable-length attributes are being used with VLOC_USER, then sd_ble_gatts_value_set() must be called? If the characteristic value is large, is there any way to avoid the memcpy penalty in sd_ble_gatts_value_set()?

    Would it be OK to call sd_ble_gatts_value_set() with the correct p_len, but then to specify a NULL p_value (since the value is VLOC_USER)? That should satisfy the softdevice bookkeeping for variable-length attributes without actually unnecessarily copying data around?

Children
No Data
Related