本文介绍了[iOS] [BLE]获取协商MTU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我目前正在iOS上开发BLE应用程序.在我的应用程序中,我需要实现一个分段协议以使用BLE发送大数据.我的应用程序需要扮演中心角色.

I'm currently developing a BLE App in iOS.In my application I need to implement a segmentation protocol to send large datas using BLE.My application need to have the Central role.

我的问题是我无法获得协商的MTU.我可以获得外围设备的maximumWriteValueLength,但它比我的外围设备大,找不到我的中央对象的maximumWriteValueLength.

My issue is that I can't get the negotiate MTU. I can get the maximumWriteValueLength of my peripheral but it is bigger that mine and can't find the maximumWriteValueLength of my central object.

有人知道找到协商MTU的方法还是访问我的CBCentralManager的CBCentral对象的方法吗?

Did someone know a way to find the negotiate MTU or a way to access the CBCentral object of my CBCentralManager?

推荐答案

我将为遇到相同问题的人解答.

I will answer for people with same issue.

现在(2017年2月),处于外围设备角色的iPhone的MTU始终为158.因此,我在短期解决方案(只是进行一些测试)中发现的是将中央MTU与158进行比较,然后选择较小的MTU.对于解决方案,更稳定的外设将在连接后将读取的特定特性内写入MTU大小.

Right now (February 2017) the MTU of iPhone in Peripheral role is always 158.So what I have found in short solution (just to make some test) is to compare the Central MTU to 158 and take the smaller one.For a solution more stable peripheral will write the MTU size inside a specific characteristic that I will read after the connection.

这篇关于[iOS] [BLE]获取协商MTU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 15:55