When the firmware calls to disconnect the peripheral, my delegate gets called, (didDisconnectPeripheral
), after that, I start a timer and I try to reconnect in 5 seconds (the timer has repeats enabled).
My didFailToConnectPeripheral
does not get called, and neither does didConnectToPeripheral. After about 30 seconds, the chip automatically reconnects with the app.
Even though I try to call [_manager cancelPeripheralConnection:_peripheral];
the board fails to disconnect cleanly.
Does anyone have more information on this "limbo" state that the peripheral finds itself in? I have found these pages: iOS 6 - Bluetooth LE disconnect and iOS CoreBluetooth reconnecting device with UUID and it seems this issue is with Core Bluetooth. Does anyone know how to get around this problem?
I am getting the following error:
Error Domain=CBErrorDomain Code=6 "The connection has timed out unexpectedly." UserInfo=0x1e09c050 {NSLocalizedDescription=The connection has timed out unexpectedly.}
The reason I have to disconnect is because the processor on the board is being used up to do other things and hence the radio cannot be kept alive.
Here is the link to the discussion on apple dev forums: https://devforums.apple.com/message/898902