Android应用程序蓝牙确定配对设备之间的距离

发布于 2024-11-25 03:48:52 字数 556 浏览 0 评论 0原文

所以今年夏天我正在尝试 Android 开发。当一对连接的设备超出彼此的范围时,我试图制作一种警报应用程序。

通过查看互联网/堆栈溢出,似乎查看 RSSI 值将帮助我实现这一目标。

然而,RSSI值似乎只能在与设备连接时读取,也就是说它不会自行更新(或者没有方法这样做)。

  1. RSSI 值是实现我的目标的唯一方法吗?
  2. 是否可以使用 RemoteDeviceRemoteDeviceHelper?有人试过这个吗?
  3. 任何其他建议和提示将不胜感激

so I'm trying my hand at android developing this summer. I was trying to make a sort of alarm app when a pair of connected devices go out of range of each other.

From looking around on the internet / stack overflow, it seems that looking at the RSSI value will help me achieve this.

However, it seems that the RSSI value can only be read at the time of connection with the device, that is it doesn't update itself (or there is no method to do so).

  1. Is the RSSI value the only way to achieve my goal?
  2. Would it be possible to use RemoteDevice and RemoteDeviceHelper? Has anyone tried this?
  3. Any other suggestions and hints would be much appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

世界和平 2024-12-02 03:48:52

您可以与设备建立连接并与设备交换心跳信息,您可以使用有效心跳信息的接收来检测设备是否在范围内和/或超出范围。
您的算法可以结合使用此信息和连接丢失来检测设备是否超出范围并引发警报。

Android 中的 RSSI 仅在发现过程中通过公共 API 可用,读取 RSSI 的其他非公共方式(如 RemoteDeviceHelper)也应该是可能的,但 RSSI 本身并不能很好地指示距离。

You could establish a connection with the device and exchange heartbeat information with the device , you can use the reception of valid heartbeat information to detect device being in range and or going out of range..
Your algorithm can use this information in conjunction with the connection loss to detect device being out of range and set off the alarm.

RSSI in Android available via public APIs is only during the discovery process, the other non public means of reading the RSSI (like in RemoteDeviceHelper) should also be possible , but RSSI by itself is not a good indication of distance.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文