简体   繁体   中英

How to calculate distance between two iOS devices using Multipeer connectivity(Wifi network)?

How to calculate the distance between two iOS devices using a wireless connection.

I figure out we can calculate using BLE , using RSSI number.

But the range of the device varies and the device placed in the room far away cannot be discovered.

My requirement is to calculate the distance device present in the room.

I have looked into the Multi-peer connectivity framework , but there is no such thing as the RSSI number.

Thanks in advance.

You can check the new NearbyInteraction https://www.reddit.com/r/iOSProgramming/comments/hfq5w8/nearbyinteraction_guide_and_github_repository/?utm_source=share&utm_medium=web2x&context=3

but will works on iphone 11 and above, bcz thes devices have the U1 chip

@Lance Samaria and @ Bassem Halawa here is the code using iBeacon. I was able to achieve distance proximity 85% to 90%. I have used Kalman filter to reduce background noise.

Here is the link for Kalman filter: - [https://stackoverflow.com/q/29027824/9673374][1]

I have calculated distance using RSSI value here is the code supporting that.

 func calculateNewDistance(_ txCalibratedPower: Int, rssi: Int) -> Double {
        if rssi == 0 {
            return -1
        }
        let ratio = Double(exactly:rssi)!/Double(txCalibratedPower)
        if ratio < 1.0 {
            return pow(10.0, ratio)
        }
        else {
            let accuracy = 0.89976 * pow(ratio, 7.7095) + 0.111
            return accuracy
        }
    }

Let me know if this was helpful. [1]: Kalman filter for RSSI in iOS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM