Reputation: 885
I am looking for a way to do a Bluetooth device scan and get all the devices that are discoverable with their distance. If it's possible can I archive it without pairing?
I assume a similar logic is used by iBeacons where it is possible for an app to get a distance from a beacon without pairing to it.
Upvotes: 1
Views: 506
Reputation: 66
Are you using linux/Bluez? One thing you can do is to scan for devices with some custom code or an
hcitool scan
Then you just need to be monitoring with hcidump or something similar, and you can get relative distance locations based on the RSSI value. Here is an example output:
hcidump -a
< HCI Command: Inquiry (0x01|0x0001) plen 5
lap 0x9e8b33 len 8 num 0
> HCI Event: Command Status (0x0f) plen 4
Inquiry (0x01|0x0001) status 0x00 ncmd 1
> HCI Event: Extended Inquiry Result (0x2f) plen 255
bdaddr 11:22:33:44:55:66 mode 1 clkoffset 0x129e class 0x7a020c rssi -89
Of course you would probably want to make your scan loop so that you will continuously get the RSSI.
Upvotes: 3