Search code examples
javaandroidbluetoothbluetooth-lowenergy

Does Blob Request's offset goes beyond 512 in BLE?


If I have a long attribute holding some 900 characters (900bytes)in android(server).When I try to read that through a Read Blob Request from computer(client), offset gets incremented by 22 starting from 0.(0,22,44...512) and Blob response will e sent accordingly. But, I could not see 534 even if the attribute(characteristic) still has data to be read. I want to understand 1)Is this the max limit in BLE and 2)how to send remaining data in one go from the same characteristic.


Solution

  • The maximum length of an attribute value is 512 bytes. That's why it's impossible to read beyond this offset. A proper Bluetooth stack should complain if you try to assign a larger value than what is allowed to a Characteristic, but Android.. well.. is Android...

    So you can not read those "extra bytes" beyond offset 512, since they do not exist.

    If you negotiate a larger MTU, you can read a larger part in one go. If you set it to 517, you can always read a maximum sized value using any GATT procedure in one single transaction.