检测具有已知 ID 的隐藏蓝牙设备
我有目标蓝牙设备 MAC-ID,想查看它是否在范围内。如果我有目标设备的 ID 并且它处于隐藏模式,如何建立与目标设备的连接?
我为此使用bluecove(java)。
I have the target bluetooth device MAC-ID and would like to see if it is in range. How can I establish a connection to the target device, if i have it's ID and it's in hidden mode?
I'm using bluecove (java) for this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定你所说的“隐藏模式”是什么意思。您可以连接到不可发现的设备,但无法连接到不可连接的设备。
通常,使用 JSR-82(或 Bluecove,一种 JSR-82 实现),您需要有一个
RemoteDevice
对象才能打开连接。获取RemoteDevice
的唯一方法是通过设备搜索。您似乎无法在您的情况下进行设备搜索,因为该设备处于“隐藏”状态。在 Bluecove 中,您会注意到
RemoteDevice
有一个受保护的构造函数,它接受蓝牙地址字符串。您可以创建 RemoteDevice 的子类,只需将该构造函数公开即可。例如:然后您可以创建
MyRemoteDevice
的实例,向其传递已知的 MAC 地址,并使用它打开连接。I'm not sure what you mean by "hidden mode." You can connect to a device that is not discoverable, but you cannot connect to a device that is not connectable.
Generally, using JSR-82 (or Bluecove, a JSR-82 implementation) you need to have a
RemoteDevice
object in order to open a connection. The only way to get aRemoteDevice
is via device search. It looks like you can't do a device search in your case, as the device is "hidden."In Bluecove, you'll notice that
RemoteDevice
has a protected constructor that takes a Bluetooth address String. You can create a subclass ofRemoteDevice
that simply makes that constructor public. For example:You can then create an instance of
MyRemoteDevice
, passing it the known MAC address, and use it to open the connection.