Java me Java me:我们可以从开放的从属连接检索所连接设备的蓝牙地址吗?
以下是发生的典型事件序列:Java me Java me:我们可以从开放的从属连接检索所连接设备的蓝牙地址吗?,java-me,network-programming,bluetooth,io,master-slave,Java Me,Network Programming,Bluetooth,Io,Master Slave,以下是发生的典型事件序列: 主机设备打开服务(主机设备接受并打开所有传入连接) 远程设备连接到主机设备 现在,我们在主机设备上打开了一个从机连接 在主机设备上,我想知道远程设备的蓝牙地址。 我总是可以将它作为数据从远程设备传递到主机设备,但是 我能在不进行任何数据传输的情况下从连接对象中提取它吗 提前谢谢…我想这会对你有所帮助 // retrieve the device that is at the other end of // the Bluetooth Serial Port Profi
我总是可以将它作为数据从远程设备传递到主机设备,但是 我能在不进行任何数据传输的情况下从连接对象中提取它吗
提前谢谢…我想这会对你有所帮助
// 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);
Vivart的答案是正确的,但它意味着您根本没有看过JSR82文档。这个API中的方法相对较少,但是有一个叫做RemoteDevice.getBluetoothAddress()的方法,很明显这将要做什么,不是吗?