Search code examples
androidbluetoothrssi

android bluetooth : read remote RSSI on multiple connected devices


I'm developing an application (minSdkVersion 21, targetSdkVersion 23) where I have to:

1.discover devices

2.make a BLE Gatt connection to 3 devices

3.get the remote RSSI from the 3 devices, simultaneously, every 100ms.

I can make the 3 BLE Gatt connections using a "BluetotthGatt" object for each connection. I start the first operation to read the remote RSSI using a "handler" with a "postDelayed" method, and It works fine.

When I start reading the second read remote RSSI operation (while the 1st one is running) using a second "handler", the application calls the 1st "readRemoteRssi()", then the 2nd "readRemoteRssi()", but in the callback function "onReadRemoteRssi()", I receive only for one device which is the second one.

Is there a way to get at the same time the remote RSSI of multiple connected devices ?

Thank you for you help ! MBR


Solution

  • I solved the problem. I missed to get the callback "gatt.getDevice();" to check which device is receiving the remote rssi, so I used the last gatt.getDevice() that was called when I received my last connection.