蓝牙发现与连接
因此,在我寻求不断更新的 RSSI 值的过程中,我被迫采用这种低效的方法。我尝试过使用 bluecove 2.1.1,但它给了我一些库错误和运行时错误,我不想再浪费时间处理这些错误。开发人员指南将发现定义为扫描附近可发现设备的过程。
正在调用方法 Intent.getShortExtra(BluetoothDevice.EXTRA_RSSI, Short.MIN_VALUE);这段时间可能吗?
或者必须要两个设备先建立连接,上面的方法才有意义吗?
也就是说,对于我的 poll() 方法,我是否可以首先将有问题的设备的 MAC 地址保存到某个变量 mac_addr,将 RSSI 值保存到某个变量 my_rssi,然后每次调用 poll() 时,都会运行一次新的扫描,并且 mac 地址与 mac_addr 匹配的设备成为目标并更新 my_rssi 字段?
So in my quest to obtain a constantly updating RSSI value, I have been forced to resort to this inefficient method. I've tried using bluecove 2.1.1, but it's given me some library errors and runtime errors that I do not want to waste anymore time dealing with. The developers guide defines discovery as the process of scanning for nearby, discoverable devices.
Is calling the method Intent.getShortExtra(BluetoothDevice.EXTRA_RSSI, Short.MIN_VALUE); during this time possible?
Or must the two devices establish a connection first for the above method to have any significance?
That is, for my poll() method, could I first save the MAC address of the device in question to some variable mac_addr, save the RSSI value to some variable my_rssi, then every time poll() is called, a new scan is run, and the device whose mac address matches that of mac_addr is targeted and updates the my_rssi field?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
准确地说,您可以仅在设备发现扫描期间获取 RSSI 值。我的硕士研究论文就是关于这个主题的。这是因为活动连接期间的 RSSI 值不可靠(由于 RSSI 值本身的性质),因此 Google Android 工程师没有通过 API 公开它。
这样做的优点:
缺点
然而,不断执行设备会出现问题发现它会消耗移动设备上的大量电池......
Exactly or better, you can only get the RSSI value during a device discovery scan. My MSc research thesis was about that topic. This is because an RSSI value during an active connection is not reliable (due to the nature of the RSSI value itself) and hence Google Android engineers did not expose it through the API.
Advantage of this:
Disadvantages
The problem however with constantly executing a device discovery is that it consumes a lot of battery on the mobile device...