如何查找已连接蓝牙设备的信号强度
在我的一个应用程序中,我需要显示与我的手机配对的所有 Wi-Fi 和蓝牙设备及其信号强度。有了 Wi-Fi,我就可以显示信号强度(RSSI)。但我的蓝牙有问题。我寻找了一些适合这项任务的方法;我找到了一种方法:
intent.getShortExtra(BluetoothDevice.EXTRA_RSSI, Short.MIN_VALUE);
但它只显示未与我的手机配对的新设备 RSSI。有没有办法获取所有蓝牙设备的 RSSI?
In one of my applications, I need to display all the wi-fi and Bluetooth devices which are paired to my mobile, and their signal strengths. With wi-fi, it's okay for me to display signal strength (RSSI). But I have a problem with the Bluetooth. I searched for some method which is suitable for this task; I found one method:
intent.getShortExtra(BluetoothDevice.EXTRA_RSSI, Short.MIN_VALUE);
But it is displaying only the new device RSSI which is not paired to my mobile. Is there any idea for getting all Bluetooth devices RSSI?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于蓝牙 RSSI,您可以读取已连接设备的 RSSI,或执行蓝牙发现以检查附近设备的 RSSI。
基本上,蓝牙发现是向范围内的所有电台广播以做出响应。当每个设备响应时,Android 会触发 ACTION_FOUND 意图。在此意图中,您可以 getExtra EXTRA_RSSI 来获取 RSSI。
请注意,并非所有蓝牙硬件都支持 RSSI。
另相关:Android IRC Office Hours 关于 Android 蓝牙 RSSI 的问题
For bluetooth RSSI, you can read RSSI for connected devices, or perform a bluetooth discovery to check the RSSI for nearby devices.
Basically a bluetooth discovery is a broadcast to all stations within range to respond back. As each devices respons back, Android fires off an ACTION_FOUND intent. Within this intent you can getExtra EXTRA_RSSI to obtain the RSSI.
Note that not all bluetooth hardware supports RSSI.
Also Related: Android IRC Office Hours Question About Android Bluetooth RSSI