有没有办法在 iOS 上增加 MTU 大小? [英] Is there any way to increase MTU size on iOS?

查看:112
本文介绍了有没有办法在 iOS 上增加 MTU 大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在谷歌上进行了大量研究但没有积极结果后,我在这里提出了一个问题.

After researching a lot with no positive result on Google, it made me post a question here.

我想知道是否有办法与 BLE 外设协商 MTU 大小.

我在我的应用程序中使用 Plugin.BLE 包来连接蓝牙.在其他设备上一切正常,但是,通过与 iOS 设备配对,MTU 大小默认为 20,无法设置.

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.

这是我请求 MTU 时代码的样子:

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}");

你们有没有办法让 App 在 iOS 上协商 MTU 大小?

Do you guys have any solution to let App negotiate the MTU size on iOS?

推荐答案

蓝牙 LE 连接参数在连接建立时在对等方(中央和外设)之间协商.这个过程在iOS端没有API访问,但可以在另一端更改.默认情况下,您会获得向后兼容的 BLE 4.0 参数(MTU=23,Datalength=27).如果外设至少为 4.2,它可以协商并获得更好的值.
我刚刚用我的 iPad Pro(2018/iOS 13.5)进行了测试,我可以得到 MTU 247 数据长度 251.

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.

(我们在 Nordic nRF52840 芯片上执行此操作,因此如果这适用于您,请查看 Nordic apis 以了解如何执行此操作)

(We're doing this on Nordic nRF52840 chips, so look in the nordic apis for how to do it if this applies to you)

这篇关于有没有办法在 iOS 上增加 MTU 大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆