how to get Distance between wifi access point and Mobile Device

眉间皱痕 提交于 2019-12-09 07:18:43

问题


i am developing an android application which have module to search all nearest / detected wifi hotspot.

i can get all detail from searched wifi hotspot like, SSID, BSSID, capabilities, frequency, level and timestamp

with these information, i also need Distance of wifi ( The distance between wifi accesspoint and Mobile Device )

i am using below lines to get Distance.

double exp = (27.55 - (20 * Math.log10(freqInMHz)) + Math.abs(levelInDb)) / 20.0;
double distanceM = Math.pow(10.0, exp);

this will return distance in meter.

i got these code by reserch on google from many pages.

but i think i am going wrong, this code is returning wrong distance. i also tried a lot on google search but not getting accurate output.

Please help me. how can i get Distance between Wifi AP and Mobile device?


回答1:


This code:

double exp = (27.55 - (20 * Math.log10(freqInMHz)) + Math.abs(levelInDb)) / 20.0; double distanceM = Math.pow(10.0, exp);

Works under the assumption of free space path attenuation between two isotropic antennas and the AP transmitting at a power of 20dBm (and the math is not even correct; the frequency dependence of free space path loss is different; not that is matters for the bands of W-LAN, uses, the correction is in the 27.55).

In reality you're dealing with anisotropic antennas, obstacles in your path, diffraction effects and the AP varying it's power output to save energy if no high bandwidth is required.

Or in other words: It's totally impractical to obtain a reliable distance figure just looking at the received power. It can give you a ballpark, order of magnitude, but not something that's remotely accurate. This is just basic physics.

The only reliable way of measuring distance is time-of-flight. For this you have to measure the roundtrip time between the device and the access point. Since we're dealing with the speed of light and distances in the order of meters up to 100m (top), this means measuring nanoseconds. Can be done but requires some work. See the link SatelliteSD gave you (it's in German but the diagrams and keywords should be understandable).




回答2:


It is possible, you could use the Time-of-Flight approach. Keep in mind that you can't rely on the messages recieved, but on the overhead received (like ACK) I can only come up with this reference (german language) measuring of signal runtimes And from a quick read I think it is a very tedious thing to do.




回答3:


No, it is not possible.

You'll not be able to find the hotspots distance from your current device location to the actual hotspot.

It seems that the hotspots don't report their coordinates.

Check the Link which has more detailed info.




回答4:


There is a method called "triangulation" but for this case you have least 3 hotspot. You can answer with detail in this pdf.

http://www.see.ed.ac.uk/~slig/papers/ITM2010.pdf



来源:https://stackoverflow.com/questions/28231999/how-to-get-distance-between-wifi-access-point-and-mobile-device

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