How do I determine if a read characteristic has exceeded the maximum length of the MTU and I need to use BLOB to read all the data. How do I know I have read all data using BLOB?
Apologise will using SDK16
How do I determine if a read characteristic has exceeded the maximum length of the MTU and I need to use BLOB to read all the data. How do I know I have read all data using BLOB?
Apologise will using SDK16
Hello,
Check out the documentation for sd_ble_gattc_read (uint16_t conn_handle, uint16_t handle, uint16_t offset) which will trigger the BLE_GATTC_EVT_READ_RSP event, see ble_gattc_evt_read_rsp_t .:
https://docs.nordicsemi.com/r/6ufiCB5WB2ID45~3kILwRQ/H1j5QdVUKTWf~~mwy4FZUw?section=ga813daa5810a1d2ed31d2d6fe49d3ef11
https://docs.nordicsemi.com/r/6ufiCB5WB2ID45~3kILwRQ/v6HRLI3gmtp0K1VFDh6mcQ
"This function initiates or resumes a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor to be read is longer than ATT_MTU - 1, this function must be called multiple times with appropriate offset to read the complete value."
So something along the lines of:
Client Server
|--- Read(handle, offset=0) ---->|
|<-- ReadRsp(len=max_chunk) -----| ← full chunk, more data
|--- Read(handle, offset+=len) ->|
|<-- ReadRsp(len=max_chunk) -----| ← full chunk, more data
|--- Read(handle, offset+=len) ->|
|<-- ReadRsp(len < max_chunk) ---| ← partial chunk, DONE
Kenneth
I assume the answer is that if the length of the response equals the MTU then you assume there is more data to read. Of course if exactly equal we will do a futile read that has length 0
I assume the answer is that if the length of the response equals the MTU then you assume there is more data to read. Of course if exactly equal we will do a futile read that has length 0