We are currently working with Bluetooth LE and want to send a 128 character string to a gatt service.
Now the Bluetooth Specs say that the maximum packet size of BLE is 22 bytes, my string will never fit in the packet.
We are thinking about chunking it up and send it in iterations.
Is this the usual way of doing things?
Yes, you need to chunk the data into 18 bytes pieces, then send a series of
Prepare Write Requests to the Server. Each of this request has 3 parameters:
<li>Attribute handle (2 bytes)</li>
<li>Attribute offset (2 bytes)</li>
<li>Data part (max 18 bytes)</li>
So you would first send a packet with offset 0, then a packet with offset 18, then 36 etc. When you do that, the Server queues all your requests.
In the end, you send an
Execute Write Request and the Server writes all the bytes in one shot.