开发者

Java me : Can we retrieve bluetooth address of connected device from an open slave connection?

开发者 https://www.devze.com 2022-12-24 17:56 出处:网络
Here is a typical sequence of events that occur : Host device opens a service ( Host device accepts and opens all incoming connections)

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...


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消