How do I find out the relationship between MTU and maximum characteristic size in Bluetooth Low Energy (BLE)?
I have a BLE developer board running an 'echo' program - so whatever it receives, it just immediately replies.
On my Android device, if I request an MTU of 247 bytes (which succeeds) and then write a 247-byte characteristic, it gets sent as two packets: one with 242 bytes and one with 5 bytes. Any attempt to write a characteristic with more than 244 bytes results in 2 packets - the first one with 242 bytes, the second one with the remaining bytes. Not sure why the first packet is 242 bytes long instead of 244, but there it is.
If, instead, I request a 100-byte MTU, the same kind of thing happens, but the packets get split when the characteristic is more than 97 bytes long, and the first packet is always 95 bytes long.
So it seems pretty clear that on this particular Android device, the maximum packet length is 3 bytes shorter than the MTU value. I've seen pages talking about MTU on the iOS where the packet length is 3 bytes shorter than the MTU value.
Am I guaranteed that the difference between MTU and maximum characteristic length will be 3 bytes, on all mobile devices and all BLE implementations?