简体   繁体   English

Android蓝牙:在多个连接的设备上读取远程RSSI

[英]android bluetooth : read remote RSSI on multiple connected devices

I'm developing an application (minSdkVersion 21, targetSdkVersion 23) where I have to: 我正在开发一个应用程序(minSdkVersion 21,targetSdkVersion 23),我必须:

1.discover devices 1.发现设备

2.make a BLE Gatt connection to 3 devices 2.将BLE Gatt连接到3个设备

3.get the remote RSSI from the 3 devices, simultaneously, every 100ms. 3.每100毫秒同时从3个设备中获取远程RSSI。

I can make the 3 BLE Gatt connections using a "BluetotthGatt" object for each connection. 我可以使用每个连接的“ BluetotthGatt”对象建立3个BLE Gatt连接。 I start the first operation to read the remote RSSI using a "handler" with a "postDelayed" method, and It works fine. 我开始使用“ handler”和"postDelayed"方法读取远程RSSI的第一个操作,并且工作正常。

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. 当我开始使用第二个“ handler”读取第二个读取的远程RSSI操作(在第一个正在运行时)时,应用程序调用第一个"readRemoteRssi()" ,然后调用第二个"readRemoteRssi()" ,但在回调函数中"onReadRemoteRssi()" ,我仅收到一台设备(第二台设备)的信息。

Is there a way to get at the same time the remote RSSI of multiple connected devices ? 有没有办法同时获得多个连接设备的远程RSSI?

Thank you for you help ! 谢谢你的帮助 ! MBR MBR

I solved the problem. 我解决了问题。 I missed to get the callback "gatt.getDevice();" 我错过了获得回调“ 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. 来检查哪个设备正在接收远程rssi,所以我使用了收到我的最后一个连接时调用的最后一个gatt.getDevice()。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM