那么iOS6及其如何处理蓝牙LE断开是怎么回事?在设备立即断开之前,但由于某些奇怪的原因,设备等待断开约30-60秒.我需要它来断开ASAFP!
我一直在互联网上试图弄清楚如何立即断开与外围设备的连接,我发现这个漂亮的电子邮件解释了一种解决方法是取消订阅有关服务特性的通知.
现在我想我正在那样做...当我想断开连接时我打电话 [connected_device setNotifyValue:NO forCharacteristic:connected_characteristic]
然后,在didUpdateNotificationStateForCharacteristic函数中,我有......
if((int)characteristic.isNotifying == 0){
[manager cancelPeripheralConnection:peripheral];
}
Run Code Online (Sandbox Code Playgroud)
在函数didDisconnectPeripheral中......
connected_peripheral = nil;
connected_characteristic = nil;
[connected_peripheral release];
[connected_characteristic release];
Run Code Online (Sandbox Code Playgroud)
我也很好地看了一下Apple的CoreBluetooth温度传感器示例,但它并没有真正帮助太多....
对此的任何帮助都会很棒!! 我只是不知道我错过了什么.....
更新:看起来应用程序需要连接到蓝牙设备至少一分钟才能断开连接.如果应用程序连接超过一分钟,它将在发送命令时立即断开连接.否则,它将等到那一分钟标记实际断开.
更新:当我尝试在一分钟标记之前断开连接时,当设备实际断开连接时,我将以下输出到日志.
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.
Run Code Online (Sandbox Code Playgroud)