问题描述
我正在开发一个将使用iBeacons进行室内导航的应用程序,我发现函数locationManager:rangingBeaconsDidFailForRegion:withError:
的调用率还不够高,因此我要从CoreBluetooth的.
I'm developing an application that will use iBeacons for indoor navigation, and I found that the rate the function locationManager:rangingBeaconsDidFailForRegion:withError:
is being called is not high enough, so I'm going to add the RSSI data from CoreBluetooth's centralManager:didDiscoverPeripheral:advertisementData:RSSI:
.
我发现一个奇怪的事实:当我使用CoreLocation收听iBeacon并记录外围设备ID时:
And I found a curious fact: when I listen to the iBeacon with CoreLocation and log the peripheral id:
- (void)centralManager:(CBCentralManager *)central
didDiscoverPeripheral:(CBPeripheral *)peripheral
advertisementData:(NSDictionary *)advertisementData
RSSI:(NSNumber *)RSSI
{
NSLog(@"%@, RSSI: %@", peripheral, RSSI);
在不同设备上报告每个信标具有不同的UUID:
each beacon is reported with different UUID on different devices:
A25804BD-D77A-5004-4C2C-301D996C7367 - my iPhone 5
843F4237-6059-9A5E-AA34-0BD92304BE1F - colleague's iPhone 5
77685805-C253-52BD-B787-8B95308834FB - other colleague's iPad mini
这个想法是将每个信标的UUID绑定到它的位置,所以这种行为是功能上的破坏.
The idea was to bind UUID of each beacon to its location, so this behavior is quite functionality-breaking.
为什么在不同设备上物理上相同的信标(未关闭/打开电源)的UUID不同?这是预期的行为吗?如果是的话,我该如何退出呢?
Why the UUID of physically the same beacon (not powered off/on) is different on different devices? Is it an expected behavior? If it is, how could I opt out of it?
推荐答案
您无法使用CoreBluetooth
读取标准iBeacons的标识符.就像克里斯·斯特拉顿(Chris Stratton)在评论中说的那样,CoreBluetooth为您提供的UUID是设备UUID,它是iOS在每个会话的基础上随机生成的.它与iBeacon ProximityUUID无关.
You cannot read the identifiers of standard iBeacons using CoreBluetooth
. As Chris Stratton said in his comment, the UUID that CoreBluetooth gives you is a device UUID, which is randomly generated on a per-session basis by iOS. It has nothing to do with the iBeacon ProximityUUID.
有关为何无法使用CoreBluetooth
读取iBeacon标识符的更多详细信息,请参见:
More details on why you can't read iBeacon identifiers with CoreBluetooth
are here: http://developer.radiusnetworks.com/2013/10/21/corebluetooth-doesnt-let-you-see-ibeacons.html
确实,您只能通过locationManager:didRangeBeacons:inRegion:
回调进行RSSI测量.这是进行自定义距离估计的真正障碍.在幕后,iOS可以收集以10Hz传输的iBeacon的10倍的测量结果.没错,您可以使用CoreBluetooth
进行更多的测量,但是问题在于,没有可靠的方法来排列使用CoreBluetooth
看到的哪些蓝牙设备与使用CoreLocation
可以看到的iBeacons相对应.
It is true that you only get on RSSI measurement per locationManager:didRangeBeacons:inRegion:
callback. This is a real obstacle to doing a custom distance estimate. Behind the scenes, iOS can gather 10x as many measurements for iBeacons transmitting at 10Hz. You are correct that you can get more measurements using CoreBluetooth
, but the problem is that there is no reliable way of lining up which bluetooth devices you see with CoreBluetooth
correspond to the iBeacons you can see with CoreLocation
.
这篇关于iBeacons的UUID在不同的设备上是不同的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!