Reputation: 767
After researching a lot with no positive result on Google, it made me post a question here.
I would like to know if there is a way to negotiate the MTU size with a BLE peripheral.
I am using Plugin.BLE
package in my App in order to connect to Bluetooth. Everything works fine with other devices, but however, by pairing with an iOS device, the MTU size is 20 by default, and can't be set.
This is how my code looks like when I request the MTU:
await Run(async () => mtu = await device.RequestMtuAsync(512));
Msg.Log(this, $"mtu is {mtu}");
Do you guys have any solution to let App negotiate the MTU size on iOS?
Upvotes: 0
Views: 8786
Reputation: 517
Bluetooth LE connection parameters are negotiated between peers (central and peripheral) when the connection is established. There is no API access to this process on the iOS side, but it can be changed on the other side. By default, you get backward-compatible BLE 4.0 parameters (MTU=23, Datalength=27). If the peripheral is at least 4.2 it can negotiate and get better values.
I just tested with my iPad Pro (2018/ iOS 13.5) and I can get MTU 247 datalength 251.
Bottom line: do this on the peripheral side before you start exchanging data.
(We're doing this on Nordic nRF52840 chips, so look in the nordic apis for how to do it if this applies to you)
Upvotes: 0