Question

According to IOS Developer Library documentation maximumUpdateValueLength provide maximum amount of data, in bytes, that the central can receive in a single notification or indication. Is there similar way to get the same thing done by IOS 6 because maximumUpdateValueLength is only for IOS 7 ?

Documentation for maximumUpdateValueLength: https://developer.apple.com/library/ios/documentation/CoreBluetooth/Reference/CBCentral_Class/Reference/CBCentral.html#//apple_ref/occ/instp/CBCentral/maximumUpdateValueLength

Was it helpful?

Solution

The easiest way to figure out the maximum packet size is to respond with long data to a read request. For details on how you should implement it, search other SO questions or check out the Core Bluetooth Programming Guide. The maximum data length for a single read or write is 512 bytes. You shouldn't try with longer data. You will be able to determine the maximum length by observing the increments of the offset parameter. E.g. if you see the values: 0, 20, 40 in subsequent callbacks, then you can deduct that the max length is 20 bytes.

If you want to determine the value at runtime and use it programmatically in your code, then you'll have to create your own solution based on this method.

As a hint. With the iPhone4S you'll see 20 bytes and the iPhone5+ will give something around 120 bytes. But best is to not build on this value and try to design your code to be as general as possible.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top