CoreBluetooth for beacons

I have a project that requires ranking beacons, I looked through a lot of code examples that uses everything CLLocationManagerand CLBeaconRegion. My problem is that the callback is didRangeBeaconsonly called once per second.

Although I have not found code samples specifically for beacons, can I correctly think that CoreBluetooth will give me more control over how often my application scans beacons?

My thinking is that if I can scan beacons at a higher speed (say, ever 200 ms), I can use more rssi values ​​in my filter function and therefore get more accurate proximity without delaying too much time . Am I accepting this right?

Can someone point me to some sample code / tutorial on using CoreBluetooth with beacons (if it's worth the extra effort)?

+4
source share
1 answer

If you use CoreBluetooth to scan beacons instead of CoreLocation, you get one callback for each proposal detected against one callback every second for CoreLocation. There are advantages and disadvantages of both approaches, so it is important to understand exactly how each work makes the right choice. The advantages and disadvantages are highly dependent on the advertising speed of the beacon, while the standard advertising rate of iBeacon is 10 Hz.

Using CoreLocation Ranking

, BLE, iBeacon, ProximityUUID , CLBeaconRegion. , , :

locationManager(_ manager: CLLocationManager, didRangeBeacons beacons: [CLBeacon], in region: CLBeaconRegion).

CLBeacon beacons rssi. rssi , .

10 , rssi 8-10 , ( 80-90% - , ).

1 ( , ), rssi. ( , rssi, .)

, rssi , , , rssi . CoreLocation ​​ , CoreBluetooth , .

CLBeacon accuracy proximity, rssi, ( , 20 ). API , 20 - , .

CoreBluetooth

, :

centralManager.scanForPeripherals(withServices: [], options: [CBCentralManagerScanOptionAllowDuplicatesKey: true] )

Bluetooth:

centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber)

rssi - . 10 , 8-10 ( , 100% ), rssi, . rssi, .

iOS Beacon Tools, CoreBluetooth rssi, .

CoreBluetooth :

  • iBeacon , , . , AltBeacon, Eddystone.

  • , AltBeacon, , .

  • , Eddystone, , . rssi.

+2

Source: https://habr.com/ru/post/1667240/


All Articles