3

Is there someone using blob request (long read) from an android device?

We work with a CC2540 from TI, connected to a android 4.4. We try to read a long characteristic value (size more than 23 bytes). In the android API for BLE, we have not seen a readBlob or readLong method.

We expect that the Android BLE Stack do the job for us, by reading a characteristic presentation format (same way has notification), but it doesn't works.

We have no idea how to send Blob Request through Android.

Oliv
  • 10,221
  • 3
  • 55
  • 76

2 Answers2

2

Let me make this clear that Android has only one method to read the value of a characteristic, readCharacteristic(characteristic). You can use this method to get the value of a characteristic of any length. Android takes care of forming a ReadBlob request; it's all in the back end. You'd have to change the code of your CC2540 though, to make it work with ReadBlob request. Once you make all the required changes at your CC2540 end, on calling readCharacteristic() from Android, you'll get the entire value of the characteristic which you can access in the onCharacteristicRead() callback.

Arty
  • 21
  • 2
0

You can´t, BLE characteristic values are limited at 20 bytes. So if you want to send or receive more than 20 bytes, you have to split it into 20 byte chunks. See this topic on the issue.

Community
  • 1
  • 1
JPS
  • 604
  • 5
  • 14
  • 4
    You're limited to X bytes on transfer, not on how many bytes can be contained within an attribute. That's why there's a "read blob request" method that accepts an offset to allow reading an attribute in steps. However, there doesn't appear to be a matching method for writing. I have no idea if the read method is implemented in Android, though. – Tim Tisdall May 21 '15 at 17:46
  • Ah, i misunderstood the question. So i see that a characteristic value can be a larger array of bytes than what is transferred at once.. In Android you can provide an offset if you set the characteristic value. I´m figuring out if there is a way to start the write once and let the stack handle all the transfers. – JPS May 22 '15 at 06:05