So, I'm scanning for bluetooth peripherals and logging the strength of their signals.
- (void)viewDidLoad
{
CBCentralManager *centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
[centralManager scanForPeripheralsWithServices:nil options:nil];
}
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
NSLog(@"Peripheral Discovered");
NSLog(@"%ld", (long)RSSI.integerValue);
}
At the method centralManager:didDiscoverPeripheral:advertisementData:RSSI: I have access to the RSSI number (signal strength).
What is the best way to get a closest to realtime update of this value?!
Should I set a timer and call scanForPeripheralsWithServices every X seconds? Should I implement some sort of recursive callback?
Is there any better way to get the peripheral signal strength?