I have an application which is using retrieveConnectedPeripheralsWithServices
to get the list of paired HID devices
. I can get the list and connect to the desired one successfully using connectPeripheral
code. When the connection succeeds, following delegate is being called:
- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral
and for disconnection, I get the corresponded delegate:
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
Now when the HID device
gets connected again to the iOS (directly from Setting, not from my application), I want to be informed. Is there any way to find out when an HID device
reconnected to the OS?
Finally, I found the answer.
Thanks to @Paulw11 for his guidance, based on Apple Documentation:
When the user leaves home, the iOS device may eventually become out of range of the lock, causing the connection to the lock to be lost. At this point, the app can simply call the connectPeripheral:options: method of the CBCentralManager class, and because connection requests do not time out, the iOS device will reconnect when the user returns home.