iBeacons: how to get broadcasted beacon power (txPower)

寵の児 提交于 2019-12-24 04:19:07

问题


iBeacons seem to broadcast their txPower parameter (report RSSI power at 1 meter distance) which is used in calculating beacon.accuracy and beacon.proximity properties (details on iBeacon advertisements packet can be found here).

However, CLBeacon class does not seem to have a property for txPower. Is there a way I can get txPower using Core Location framework, or need I to go down to Core Bluetooth? The reason I need this, is I want to experiment with custom beacon accuracy/proximity calculation for very quick beacon immediate range discovery. In this circumstances reverse calculating txPower from accuracy is no helper.


回答1:


Unfortunately you can not get this value programmatically with either CoreLocation or CoreBluetooth. Apple blocks access to all iBeacon data with CoreBluetooth (See my breakdown of this here.) Similarly with CoreLocation it is simply not exposed in the CLBeacon class as you have seen.

Since you say you can't to do a reverse-calculation, then the only other ways I can think of to do this are:

  1. Use an Android, OSX Mavericks, or Linux device, which offer no such restrictions on reading this field.
  2. Make a lookup table in your iOS app of all your iBeacons (with unique UUID/major/minor values vs. their txPower value)

Option 2 above obviously requires that you assign unique identifiers to all your iBeacons under test.



来源:https://stackoverflow.com/questions/24001702/ibeacons-how-to-get-broadcasted-beacon-power-txpower

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!