【发布时间】:2012-10-09 03:37:14
【问题描述】:
好的,iOS6 到底是怎么回事,它如何处理蓝牙 LE 断开连接?之前设备会立即断开连接,但现在,出于某种奇怪的原因,设备会等待断开连接约 30-60 秒。我需要它来断开 ASAFP!
我一直在互联网上搜索,试图弄清楚如何立即断开与外围设备的连接,我发现 this nifty email 解释了一种解决方法是取消订阅有关服务特征的通知。
现在我想我正在这样做.. 当我想断开连接时,我会致电 [connected_device setNotifyValue:NO forCharacteristic:connected_characteristic]
然后,在 didUpdateNotificationStateForCharacteristic 函数中,我有...
if((int)characteristic.isNotifying == 0){
[manager cancelPeripheralConnection:peripheral];
}
在函数 didDisconnectPeripheral...
connected_peripheral = nil;
connected_characteristic = nil;
[connected_peripheral release];
[connected_characteristic release];
我还仔细研究了 Apple 的 CoreBluetooth Temperature Sensor 示例,但它并没有太大帮助....
对此的任何帮助都会很棒!我只是不知道我错过了什么.....
更新:看起来应用程序需要连接到蓝牙设备至少一分钟才能允许断开连接。如果应用程序连接超过一分钟,它会在发送命令时立即断开连接。否则,它将等到那一分钟标记才真正断开连接。
更新:当我尝试在一分钟之前断开连接时,当设备实际断开连接时,我会在日志中得到以下输出。
Oct 24 16:49:35 Christophers-iPhone awdd[8168] <Error>: libMobileGestalt copySystemVersionDictionaryValue: Could not lookup ReleaseType from system version dictionary
Oct 24 16:49:35 Christophers-iPhone awdd[8168] <Error>: CoreLocation: CLClient is deprecated. Will be obsolete soon.
【问题讨论】:
标签: ios6 core-bluetooth disconnect bluetooth-lowenergy