I am using BlueZ C API to program my bluetooth mouse to read the distance. I have set up a bluetooth dongle. At the moment, I have to move the mouse at least 5-10 feet from the
hci_read_rssi
is probably not what you want. It's not the actual remote RSSI. From the BT spec section describing the HCI_Read_RSSI command:
The RSSI parameter returns the difference between the measured Received Signal Strength Indication (RSSI) and the limits of the Golden Receive Power Range for a Connection Handle to another BR/EDR Controller. Any positive RSSI value returned by the Controller indicates how many dB the RSSI is above the upper limit, any negative value indicates how many dB the RSSI is below the lower limit. The value zero indicates that the RSSI is inside the Golden Receive Power Range.
I believe the value you want is the one contained in the inquiry/scan. I know of a way to get that but not sure whether it's acceptable to you or whether it is the best way.
The bluez dbus device API has RSSI as one of the properties. The api doc can be found here.
UPDATE: I haven't tried it myself but looks like pybluez supports getting the inquiry RSSI. See this pybluez example.
Here's a simple example for bluez4:
https://bitbucket.org/kaylum/bluez-rssi-example/src