search

Home  >  Q&A  >  body text

objective-c - iOS蓝牙连接外设,调用断开方法后无法立即断开,求解决方案。

本人的蓝牙4.0相关项目现在需要实现iphone连接蓝牙外设发送数据后马上断开与外设的连接

但调用core bluetooth的[manager cancelPeripheralConnection:Peripheral]后蓝牙并不能马上断开连接,

总要等待数秒后外设才能继续广播,

开始以为是发数据占用时间,但是不发送任何数据只是连接后马上断开还是有同样的问题

用电脑和安卓手机测试都可以马上断开 应该也不是蓝牙外设固件的问题

感觉就是断开命令没有被立即发送 但是[manager cancelPeripheralConnection:Peripheral]确实执行了

求大神帮忙

PHP中文网PHP中文网2810 days ago467

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-04-18 09:27:47

    I also have the same problem, please continue to pay attention! !

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 09:27:47

    Why no one has the answer? I am also looking for this answer

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:27:47

    [manager cancelPeripheralConnection:Peripheral] method can ensure that the APP layer is disconnected immediately and can go to the disconnect callback, but the physical layer can wait about 5 seconds before the physical layer can be disconnected.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:27:47

    manager=nil; OK?

    reply
    0
  • Cancelreply