Android Question Reading Bluetooth RSSI continuosly

Paolo Pini

Member
Licensed User
Longtime User
Hi,
I have a project that connects my smartphone with a bluetooth device, I need to know when my phone is too far away from the device.

I know I can check the RSSI level with:

B4X:
    If admin.LastFoundIntent.HasExtra("android.bluetooth.device.extra.RSSI") Then
        Dim rssi As Int = admin.LastFoundIntent.GetExtra("android.bluetooth.device.extra.RSSI")
        Log("RSSI:" & rssi)
    End If

but, if I understand correctly, the RSSI updates at each Admin_DeviceFound() and this only happens after Admin_DiscoveryFinished so to check the RSSI
of my device I have to wait for the Admin_DiscoveryFinished cycle to finish and this takes many seconds.
I tried using a serial connection to check when the signal is lost, this works fine with my HC-05 but the other device I need (my car) does not accept the serial connection.
How can I check the RSSI level of a particular MacAddress continuously or almost every 5-10 seconds.

Thanks in advance.

Paolo.
 

emexes

Expert
Licensed User
When you do a Bluetooth scan, the received advertising events include an RSSI number typically -80 to -40.

Don't even need to be connected = can monitor presence (and approximate nearness) of multiple devices.

Plus saves on transmission energy cost ie battery life (from the phone's perspective).
 
Upvote 0

Paolo Pini

Member
Licensed User
Longtime User
When you do a Bluetooth scan, the received advertising events include an RSSI number typically -80 to -40.

Don't even need to be connected = can monitor presence (and approximate nearness) of multiple devices.

Plus saves on transmission energy cost ie battery life (from the phone's perspective).
thank you for your answer.

In fact I already do the periodic reading of devices in proximity, the problem is that the update of the RSSI value
occurs after 15-20 seconds because the update is carried out when "Admin_DiscoveryFinished()" expires and I wanted
to understand if there was a faster way, since I already know the MAC address of the device I want to test.


Paolo
 
Upvote 0
Top