iOS 6.0核心蓝牙外设重新连接问题

时间:2012-12-07 19:52:51

标签: ipod-touch core-bluetooth reconnect

我在iPhone 4S上运行的iOS 5.0中有一个稳定的工作应用程序。我们迁移到iOS 6.0以在具有蓝牙低能量的iPod(第5代)上运行。在iPhone 4S上,我们可以随意配对/连接,连接,断开连接和重新连接。我们在iPod上遇到同样的问题。该应用程序成功断开连接并重新连接,并且该过程可以重复2-3次,之后我们开始获得Core Bluetooth Error:14。以下是日志的样子

012-12-04 11:30:24.293 Milan[524:907] DISCONNECTED WITH READER: SriRdr11
2012-12-04 11:30:24.295 Milan[524:907] Start Time 376331424.295754 =
2012-12-04 11:30:28.241 Milan[524:907] NSConcreteNotification 0x1dd607d0 
2012-12-04 11:30:28.243 Milan[524:907] MAIN PERIPHERAL: 5F953B12-D99F-D770-4F3F-B741BA026858
2012-12-04 11:30:28.617 Milan[524:907] CONNECTED WITH PERIPHERAL: DEVICE1
2012-12-04 11:30:29.173 Milan[524:907] DISCONNECTED WITH PERIPHERAL: DEVICE1
2012-12-04 11:30:29.176 Milan[524:907] Error: The specified device has disconnected from us. -   
(null)

该应用程序认为BLE外围设备已与其断开连接,并且外围设备认为该应用已与读卡器断开连接。很明显,应用程序在这里做了一些奇怪的事情。有人能解释一下这里发生了什么吗?

这是didDiscoverPeripheral中为重新连接调用的代码。

NSString* uuid = [peripheral uuidString]; NSString* readerName = [advertisementData    
objectForKey:@"kCBAdvDataLocalName"]; 
int meterID= 0; 
NSData *deviceIdData = [NSData dataWithBytes:&meterID length:sizeof(meterID)]; 
NSLog(@"DEVICE DISCOVERED: %@ (%@)", deviceName, uuid); 
[[[DeviceBluetoothManager sharedInstance]allPeripherals] setObject:deviceIdData forKey:peripheral
uuidString]]; 
[[DeviceDefaultsManager sharedInstance] adddeviceIdToFavorites:deviceIdData 
readerName:readerName withPeripheralId:[peripheral UUID]]; 
NSDictionary* deviceInfo = [NSDictionary dictionaryWithObject:peripheral forKey:kDeviceKey];  
[[NSNotificationCenter defaultCenter] postNotificationName:kBluetoothDeviceDiscovered 
object:self userInfo:deviceInfo];

另一个问题是,如果有任何配对或结合

0 个答案:

没有答案