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

BLE_GATTS_VLOC_USER and sd_ble_gatts_value_set

When using BLE_GATTS_VLOC_USER with a variable-length characteristic, we still need to use sd_ble_gatts_value_set to keep SoftDevice appraised of updates to characteristic value length (and presumably other bookkeeping).

A major motivation for using VLOC_USER (for us, at least) is for large characteristic values.

Does that mean we must have two large buffers (a "src" and "dst" )?

Is it safe to use sd_ble_gatts_value_set() with a p_value pointing to the same user buffer that was configured in sd_ble_gatts_characteristic_add()?

Does sd_ble_gatts_value_set() properly handle this kind of "overlapping regions" between its p_value and the configured VLOC_USER buffer? I guess memcpy() is likely involved, and the man page for ARM gcc memcpy(3) reads "If the regions overlap, the behavior is undefined."

Thanks.

Related