Calculation formula:
D = 10^ ((ABS (RSSI)-A)/(Ten * N))
which
D-Calculate the resulting distance
RSSI-received signal strength (negative value)
A-Signal strength at a distance of 1 m from the transmitting and receiving ends
N-Environmental attenuation factor
Code implementation of the calculation formula
-(float) Calcdistbyrssi: (int) rssi{ int irssi = abs (RSSI); float power = (iRssi-59)/(10*2.0); return POW (power);}
The Rssi value is passed in, and the distance (in meters) is returned. Where a parameter is assigned a 59,N 2.0.
Due to the different environment, each transmitter source (Bluetooth device) corresponding parameter values are not the same. According to the truth, each parameter in the formula should be tested (calibrated).
When you do not know the exact location of the surrounding Bluetooth devices, you can only give experience values for a and n (as in this example).
Original: http://blog.csdn.net/njchenyi/article/details/46981423
Android Developer--The six Bluetooth RSSI calculation distance for Bluetooth development example