Get distance from CL Proximity
I am developing a beacon detection application using lens c and I am getting the beacon value by following
CLBeacon (uuid:<__NSConcreteUUID 0x174223ee0> XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, major:0, minor:1, proximity:2 +/- 0.32m, rssi:-49)
in this value, I want to get the proximity as value +/- 0.32m
, but then I access the proximity value. I am not getting it, how can I access this value. Can anyone help me with this. I am using the latestIOS SDK
source to share
CL Proximity will not indicate the distance in meters It will just give you the value in
CLProximityUnknown,
CLProximityImmediate,
CLProximityNear,
CLProximityFar
To find the distance in meters (for example, the lighthouse is in the 15 meter range), you need to look at this document. Formula # 19 on page 3 and basically it does this:
Received Signal Strength is related to distance using the equation below.
RSSI [dBm] = -10n log10 (d) + A [dBm]
Where
A is the received signal level in dBm at 1 meter - you need to calibrate it on your system. Since you are calibrating at a known distance, you do not need to account for your transmit frequency and this simplifies the equation. (Just place the iBeacon 1 meter away and measure its RSSI)
n is an indicator of the degree of spreading, i.e. 2.7 to 4.3 (free space has n = 2 for reference, if there are walls it will be larger).
d - distance from the sender in meters
So, you have all values except d , you need to calculate d using the above formula.
EDIT: Precision
CoreLocation also provides a property accuracy
for CLBeacon
. You are correct that this is in meters, but it shows how accurate the measurements are.
In your case, this indicates that the flare myopia is CLProximityNear, and the accuracy is +/- 0.32m.
Here is the documentation about accuracy
/*
* accuracy
*
* Discussion:
* Represents an one sigma horizontal accuracy in meters where the measuring device 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;
source to share