eklektek
eklektek

Reputation: 1173

CBPeripheral writeValue to send 40 bytes by with CBCharacteristicWriteWithResponse send 18, 18 & 2

I am writing/sending 40 bytes to a peripheral using CBCharacteristicWriteWithResponse (BLE112 using BGLib) I would have expected it to arrive in two blocks of 20 bytes. Instead it is arriving in three blocks 18, 18 & 4.

Any idea why I am seeing this behaviour?

Upvotes: 1

Views: 1321

Answers (1)

eklektek
eklektek

Reputation: 1173

I have been sniffing the initial exchange after a connection.

Via an ATT_Exchange_MTU_Req the iDevice says it can support MTU of 135 bytes! (0x0087) the BLE112 then responds with an ATT_Exchange_MTU_Rsp of 23 bytes. iOS remembers and uses this value as the basis of future comms with the peripheral (the whole point of ATT_Exchange_MTU_Req/Rsp)

In the BTSpec4.0.pdf section 3.4.6.1 Prepare Write Request it says that the Part Attribute value has ATT_MTU-5 = 23 - 5 = 18 bytes to use contain a part of the value.

Had this confirmed by a BLE guru @ Apple so reasonably sure this is correct.

Upvotes: 1

Related Questions