CLProximity不會告訴米 的距離,這將只是給你
價值
CLProximityUnknown,
CLProximityImmediate,
CLProximityNear,
CLProximityFar
要找到以米爲單位的距離(例如,信標在15米範圍內),您需要查看this文檔。其計算公式爲3頁上的#19,基本上它這樣做:
Received Signal Strength is related to distance using the equation below.
RSSI [dBm] = -10n log10 (d) + A [dBm]
凡
一個是dBm爲單位的接收信號強度在1米 - 你需要校準該系統上。由於您在已知距離進行校準,因此無需考慮傳輸頻率,這簡化了公式。 (只是放置iBeacon顯示到1米範圍,並測量它的RSSI)
Ñ是傳播路徑損耗指數即2.7〜4.3(自由空間具有n = 2的參考,如果有牆壁這將是更大)。
d是從發件人米
所以你的所有值的距離,除了d,則需要使用提到的公式來計算d。
編輯:精度
CoreLocation還提供accuracy
屬性CLBeacon
。 你是對的,它以米爲單位提供,但顯示了測量的準確度。
在你的情況下,它顯示信標接近度是CLProximityNear,它的精確度爲+/- 0.32m。
這裏是關於accuracy
/*
* accuracy
*
* Discussion:
* Represents an one sigma horizontal accuracy in meters where the measuring device's location is
* referenced at the beaconing device. This value is heavily subject to variations in an RF environment.
* A negative accuracy value indicates the proximity is unknown.
*
*/
@property (readonly, nonatomic) CLLocationAccuracy accuracy;
感謝你的答案l0gg3r但是當我從燈塔獲取值我看到這樣的事情'接近文檔:在2 +/- 0.32m'可以看出U顯示0.32米是否有訪問該值的方法? –
@CodingISLife是的,當然它是準確性屬性,請參閱我的編輯。 – l0gg3r
謝謝,我們可以建立準確度和距離之間的關係嗎? –