I do that but issue is that I can saw only iOS MacBook on list.
I didn’t add any filter to search this but I can’t find the android phone and Bluetooth speaker in list.
So any one know about this please help me out.?
Post
Replies
Boosts
Views
Activity
I get the RSSI value from the searched bluetooth device in list.
But didn't know how to Calculate the distance.
We need txPower to calculate that but from where I get this txPower.
I'm using this code but don't know it's correct.
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
}
}
I search the nearby Bluetooth devices. And using the RSSI and tx-power value (tx-power hardcoded power value Usually ranges between -59 to -65) the distance by this code.
func calculateNewDistance(txCalibratedPower: Int, rssi: Int) -> Double{
//txCalibratedPower : hard coded power value. Usually ranges between -59 to -65
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
}
}
But didn't get that much accuracy.
For android, they use the Kalman filter to remove the noise between the path and calculate the distance (80 - 85 %) accuracy.
So anyone helps me out to calculate the distance.
Question is already here but didn't have a solution : [https://stackoverflow.com/questions/3624945/how-to-measure-distance-between-two-iphone-devices-using-bluetooth)
I want to call the API when app is in background.
So timer will work in background mode after 2 3 hours.