Here is a typical sequence of events that occur :
- Host device opens a service ( Host device accepts and opens all incoming connections)
- A remote device connects to host device.
- 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);
精彩评论