检测具有已知 ID 的隐藏蓝牙设备

发布于 2024-10-11 11:22:54 字数 99 浏览 5 评论 0原文

我有目标蓝牙设备 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 技术交流群。

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

发布评论

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

评论(1

青朷 2024-10-18 11:22:54

我不确定你所说的“隐藏模式”是什么意思。您可以连接到不可发现的设备,但无法连接到不可连接的设备。

通常,使用 JSR-82(或 Bluecove,一种 JSR-82 实现),您需要有一个 RemoteDevice 对象才能打开连接。获取 RemoteDevice 的唯一方法是通过设备搜索。您似乎无法在您的情况下进行设备搜索,因为该设备处于“隐藏”状态。

在 Bluecove 中,您会注意到 RemoteDevice 有一个受保护的构造函数,它接受蓝牙地址字符串。您可以创建 RemoteDevice 的子类,只需将该构造函数公开即可。例如:

public class MyRemoteDevice extends javax.Bluetooth.RemoteDevice {
  public MyRemoteDevice(String addr) {
    super(addr);
  }
}

然后您可以创建 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 a RemoteDevice 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 of RemoteDevice that simply makes that constructor public. For example:

public class MyRemoteDevice extends javax.Bluetooth.RemoteDevice {
  public MyRemoteDevice(String addr) {
    super(addr);
  }
}

You can then create an instance of MyRemoteDevice, passing it the known MAC address, and use it to open the connection.

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