0

I'm publishing a Bluetooth LE service with three characteristics. I write 512 bytes of data on each of the first two characteristics and 1 byte on the second. The write is working properly. I know this because I browse for the device using a second device (both iOS 8.x), they find each other and the data is read properly. However, when reading the same characteristic on an iPhone 4S with iOS 7.1.2 I only get 268 bytes of data per characteristic, instead of the full 512 bytes.

To read the data I write the following in -peripheral:didDiscoverCharacteristicsForService:error:

for (CBCharacteristic * characteristic in service.characteristics) {

    //[peripheral setNotifyValue:YES forCharacteristic:characteristic];
    [peripheral readValueForCharacteristic:characteristic];
}

I also tried it with the -setNotifyValue:forCharacteristic: line uncommented. I get the data in -peripheral:didUpdateValueForCharacteristic:error:. Again, the data is read properly on iOS 8.x, but not 7. What happens is that the data for each characteristic is truncated to 268 bytes. That is, I get the first 268 bytes of the first and the second, and I get the full 1 byte of the third.

As anyone experienced something like this? Can anyone reproduce or help? Best.

Edit: As @Paulw11 replied in the comments, the same question was posted here with a solution. I've tested it and not only does it solve the problem but it's also much faster at transferring data. The problem is, it transfer the data serially, which is something that in my situation I don't see how I can apply. The thing is: I have a constant amount of data that a peripheral publishes onto a fixed number of characteristics, but there'll be several centrals reading the data from it. The fact that several centrals are reading the data prevents me from doing it serially (I think) as there's no way that several centrals can read at the same time.

Community
  • 1
  • 1
André Fratelli
  • 5,920
  • 7
  • 46
  • 87
  • 2
    I'd suggest burning one of your DTS incidents on this (you get two Apple Developer Technical Services incidents to use each year for free). And/or post it to the internal forums where its more likely to be read by an Apple Engineer. – David H Jul 01 '15 at 20:42
  • I guess you are right. I'll try the forums first and give this thing one day or two. – André Fratelli Jul 01 '15 at 20:44
  • 1
    See http://stackoverflow.com/questions/19280429/reading-long-characteristic-values-using-corebluetooth - 512 bytes is pretty big for BLE. You should check the value of central.maximumUpdateValueLength when you receive the read request – Paulw11 Jul 01 '15 at 22:22
  • That's a good answer, but unfortunately I'm not able to apply to my problem. I'll update the answer – André Fratelli Jul 01 '15 at 23:51
  • Unfortunately I don't think you can do what you want - you can't transfer more than `central.maximumUpdateValueLength` bytes at a time – Paulw11 Jul 02 '15 at 00:19

0 Answers0