Problem statement : if have multiple BLE's at my end and i connect them one by one. but now when more than 1 BLE goes out of range at the same time i am not able to detect the state in central manager of core bluetooth framework.
Explanation -
1) if i have a single BLE and i connect to that BLE, when that BLE goes out of range it calls - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
method of peripheral.
2) In - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
method i have given a call for - (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral
to get it connected whenever the BLE again comes in the range.
3) This behaviour works fine for when single BLE moves out of range at a time. and connect again when comes in the range.
4) but above behaviour not works well when more than one BLE's goes out of range at the same time.
here is my - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
code
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error {
[self.btMainDashboardViewController.tagsTableView reloadData];
for (CBPeripheral *peripheral in self.btMainDashboardViewController.app.addedTagsArray) {
if (peripheral.state == CBPeripheralStateDisconnected) {
// if tag is not released go for autoconnection
[self.centralManager connectPeripheral:peripheral options:nil];
}
}
}
Thanks in advance.