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

ble_gatts_evt_rw_authorize_request_t with offset

Hi again, If I use BluetoothGATTSetCharacteristicValue and set wr_auth = 1 in the ble characteristics, I receive a BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event. I can also see the data and length from the requestEvent->request.write.data and requestEvent->request.write.len. My question is how does the requestEvent->request.write.offset value get updated? I want to send a lot of data to my device, and with a maximum packet size of 20 bytes, it would be nice to be able to determine the offset for each packet, so I can easily re-assemble the data at the receive end. Do I need to increase the attributeCharacteristicValue.max_len? Many thanks

Parents
  • Hi Lodge,

    The offset can be used for Queued/Long Write or Reliable Write

    If your characteristic is less than 510 bytes long, you can use long write and let the stack handles the de-assembly and reassembly for you. If you having more than 510 bytes, you can think of define your own 2 bytes offset and mechanism to slit the packets and re-assembly them.

  • You can use BeginReliableWrite, or if you simply want to use queued write or long write, you just have to write with more than 20 bytes, Android will handle that automatically. For reading, as you already noticed we have the offset, so if you check and find the offset, you can reply with the correspondent offset in sd_ble_gatts_rw_authorize_reply as in the event BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST. If your characteristic doesn't require authorization, the stack will handle the long read automatically.

    On Android, I don't think you would be able to perform a single read request with a offset, except for the blob read that Android handle automatically.

Reply
  • You can use BeginReliableWrite, or if you simply want to use queued write or long write, you just have to write with more than 20 bytes, Android will handle that automatically. For reading, as you already noticed we have the offset, so if you check and find the offset, you can reply with the correspondent offset in sd_ble_gatts_rw_authorize_reply as in the event BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST. If your characteristic doesn't require authorization, the stack will handle the long read automatically.

    On Android, I don't think you would be able to perform a single read request with a offset, except for the blob read that Android handle automatically.

Children
No Data
Related