BlueSwift icon indicating copy to clipboard operation
BlueSwift copied to clipboard

can i measure distance from central to peripheral?

Open krutitrivedi opened this issue 6 years ago • 2 comments

krutitrivedi avatar Feb 27 '19 09:02 krutitrivedi

Unfortunately you can't do this in any easy way. It could be possible by discovering the peripherals and passing false via advertisementValidationHandler so the device won't connect. However this closure currently does not pass the CBPeripheral instance to be able to extract RSSI value from it. If you want that, I can include this in next release and post it in few days from now :) However RSSI does won't give you any exact information about distance, it's just received signal strength so you would have to calibrate it properly on each device the library will be used. Also it's in logarithmic scale so you would have to calculate it to meters. You can find a simple tutorial here: https://iotandelectronics.wordpress.com/2016/10/07/how-to-calculate-distance-from-the-rssi-value-of-the-ble-beacon/ Last but not least, please have in mind that without some complicated math, your results won't be exact and you can not rely on them. You can just specify if you are near or far from the device.

Please let me know if I can help in any other way after that clarification! ;)

poszposz avatar Mar 05 '19 15:03 poszposz

yes, if you reales version with distance measurement it is better

krutitrivedi avatar Mar 07 '19 10:03 krutitrivedi

Unfortunately this feature is no longer on our roadmap. Please feel free to submit the PR.

Siemian avatar Jan 12 '23 20:01 Siemian