通过 MAC 地址快速检查许多蓝牙设备
我正在创建一个工具来检查是否存在许多(~100)蓝牙设备。我已经有了他们的 MAC 地址。我只是想知道它们是否在范围内,即使未设置为可发现。
使用 hcitool name
可以做到这一点。但速度不是很快;检查每个地址最多需要 5 秒,特别是当设备不在范围内时。如果我分叉并行子进程,每个子进程仍然需要最多 5 秒,就好像 bluez 或堆栈中的某些东西正在序列化请求一样。
有没有更快的方法通过 MAC 地址检查 BT 设备是否存在?我不需要知道它们的名字,只要它们在附近(无论是否设置为可发现)。理想情况下,我想在半分钟或更短的时间内检查全部~100 个。
如果解决方案不需要 sudo (如 l2ping),则加分,但如果这是唯一的方法,则可以。平台是 Ubuntu Linux,如果重要的话可以使用 Cambridge Silicon BT 加密狗...
Thanx,
-- Steve
I'm creating a tool that checks for the presence of many (~100) bluetooth devices. I'll have their MAC addresses already. I just want to know if they're in range, even if not set to discoverable.
Using hcitool name <bt_addr>
does this. But it's not very fast; it takes up to 5 seconds to check each address, especially if the device is not in range. If I fork parallel subprocesses, it still takes up to 5 seconds each, as if bluez or something in the stack is serializing the requests.
Is there a faster way to check for the presence of BT devices by MAC address? I don't need to know the names of them, just if they're around (whether set discoverable or not). Ideally I'd like to check all ~100 in half a minute or less.
Bonus points if the solution doesn't require sudo (like l2ping), but OK if that's the only way. Platform is Ubuntu Linux, using a Cambridge Silicon BT dongle if it matters...
Thanx,
-- Steve
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不
如果设备不可发现,则没有快速有效的方法。
任何其他方案(包括请求名称)都需要建立连接 - 每个连接都需要几秒钟,连接过程无法在无线电上并行完成 - 它一次一个。
No
If the device is not discoverable then there is no fast and effecting way.
Any other scheme (including requesting the name) requires establishing a connection - which will take few seconds each, there is no way the connection process can be done in parallel at the radio - it is one at a time.