Reputation: 1565
Is there a mechanism in iOS CoreBluetooth so that an event will be triggered when a discovered (but not connected) peripheral is "lost" i.e. a peripheral that was advertising is no longer advertising .
Upvotes: 0
Views: 326
Reputation: 31
You can look in AltBeacon, an open source project we released https://github.com/CharruaLabs/AltBeacon how we do this. Check the method reportDelegates of the class AltBeacon.m
A bit more in detail. What we do it to keep reporting in an preestablished interval and then age the signal (RSSI) of the device. After a while if it is too aged you can trigger the no longer advertising callback. What we do is just to change an enum status distance to unknown.
Upvotes: 1
Reputation: 115002
You could specify the CBCentralManagerScanOptionAllowDuplicatesKey:YES
in the options to CBCentralManager
's scanForPeripheralsWithServices:
and then keep a table of observed devices, ageing the entries periodically, but this will impact battery life and you will not be able to operate once your application is no longer in the foreground. Connecting is a better option - is there some reason why you don't want to connect to the device?
Upvotes: 1