Java me:我们可以从打开的从属连接中检索已连接设备的蓝牙地址吗?

发布于 2024-08-27 01:24:32 字数 226 浏览 13 评论 0原文

以下是发生的典型事件序列:

  1. 主机设备打开服务(主机设备接受并打开所有传入连接)
  2. 远程设备连接到主机设备。
  3. 现在,我们在主机设备上打开了一个从属连接。

在主机设备上,我想知道远程设备的蓝牙地址。
我总是可以将其作为数据从远程传递到主机设备,但是 我可以以某种方式从连接对象中提取它而不需要任何数据传输吗?

提前致谢...

Here is a typical sequence of events that occur :

  1. Host device opens a service ( Host device accepts and opens all incoming connections)
  2. A remote device connects to host device.
  3. Now, we have a slave connection open at host device.

At host device, I want to know the bluetooth address of remote device.
I can always pass it as data from remote to host device, but
can I extract it from connection object somehow without any data transfer?

Thanks in advance...

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

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

发布评论

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

评论(1

青衫负雪 2024-09-03 01:24:32

我想这会对你有帮助

// retrieve the device that is at the other end of
// the Bluetooth Serial Port Profile connection,
// L2CAP connection, or OBEX over RFCOMM connection
RemoteDevice remote = 
    RemoteDevice.getRemoteDevice(
        javax.microedition.io.Connection c);
// retrieve the Bluetooth address of the remote device
String remoteAddress = remote.getBluetoothAddress();
// retrieve the name of the remote Bluetooth device
String remoteName = local.getFriendlyName(true);

i think this will help you

// retrieve the device that is at the other end of
// the Bluetooth Serial Port Profile connection,
// L2CAP connection, or OBEX over RFCOMM connection
RemoteDevice remote = 
    RemoteDevice.getRemoteDevice(
        javax.microedition.io.Connection c);
// retrieve the Bluetooth address of the remote device
String remoteAddress = remote.getBluetoothAddress();
// retrieve the name of the remote Bluetooth device
String remoteName = local.getFriendlyName(true);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文