如何确定绑定设备,以便蓝牙 RFCOMM 服务器知道要连接到谁

发布于 2024-12-04 12:13:54 字数 573 浏览 0 评论 0原文

我有一个基于以下示例的 RFCOMM 客户端/服务器设置: http: //people.csail.mit.edu/albert/bluez-intro/x502.html 我正在 Linux 系统上使用 bluez 堆栈并编写 c/c++ 代码。

我似乎无法弄清楚如何限制仅从绑定/配对设备到服务器的连接。我在谷歌上搜索过,但没有找到可以实现我的目标的示例代码。

基本上,我将有 2 个设备相互配对,并且通信将开始,但我只希望服务器允许来自它所绑定的设备的连接。将有许多设备对运行,因此必须进行此检查才能准确了解哪些设备正在相互通信。在侦听套接字上发现的来自未绑定设备的任何连接尝试都应该导致某种类型的拒绝连接。

目前,连接到服务器的设备是否与同一服务器配对并不重要,因为服务器接受任何命中侦听套接字的连接。

我想本质上我想知道如何确定我在客户端和服务器上绑定到哪些设备(如果有)。我认为蓝牙协议会为我处理这个问题,但在进行一些测试时,我似乎错了。

感谢任何可以提供帮助的人!

I have an RFCOMM client/server setup based on the example found at: http://people.csail.mit.edu/albert/bluez-intro/x502.html I am using the bluez stack on a Linux system and writing c/c++ code.

What I can't seem to figure out is how do I restrict connections to the server from only bonded/paired devices. I've searched Google and have come up empty on some kind of example code that would accomplish my goal.

Basically I'm going to have 2 devices paired to each other and communications will start, but I only want the server to allow a connection from the device it is bonded to. There will be many device pairs running so this check is necessary to know exactly which devices are communication to each other. Any connection attempt found on the listen socket from a device it is not bonded to should result in a refused connection of some sort.

Currently it doesn't matter if the device connecting to the server is paired to the same server or not as the server accepts any connection that hits the listen socket.

I guess in essence I want to know how to determine what devices I am bonded to, if any, on the client and server. I thought the Bluetooth protocol would handle this for me, but it seems as I am mistaken when running through some tests.

Thanks to anybody that can help!

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

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

发布评论

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

评论(1

初懵 2024-12-11 12:13:54

您可以通过配置 etc/bluetooth/hcid.conf 禁用进一步配对(将配对设置为无)。已配对的设备将能够使用 /var/lib/bluetooth//linkkeys 下存储的链接密钥进行通信

You could disable further pairing by configuring etc/bluetooth/hcid.conf (set pairing to none). Devices that have already been paired would be able to communicate using the stored link keys under /var/lib/bluetooth//linkkeys

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