I have a stable working app in iOS 5.0 running on iPhone 4S. We did the migration to iOS 6.0 to run on iPod (5th gen) having bluetooth low energy. On iPhone 4S we were able to pair/bond, connect, disconnect and reconnect at will. We are having issues doing the same on iPod. The app disconnects successfully and reconnects and the process can be repeated 2-3 times, and after this we start getting Core Bluetooth Error : 14. Here's how the log looks like this
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)
The app thinks that the BLE peripheral has disconnected from it, and the peripheral thinks that the app has disconnected from the reader. Quite clearly, it is the app that is doing something weird here. Can someone explain what's going on here?
Here's the code in the didDiscoverPeripheral that gets called for the reconnect.
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];
Another Question is if any of the pairing or bonding