2010-03-28 43 views
1

這裏是所發生的事件的一個典型序列:Java me:我們可以從打開的從屬連接中檢索連接設備的藍牙地址嗎?

  1. 主機裝置打開一個服務(主機設備接受,並打開所有傳入連接)
  2. 的遠程設備連接到主機設備。
  3. 現在,我們有一個在主機設備上打開的從屬連接。

在主機設備上,我想知道遠程設備的藍牙地址。
我總是可以將它作爲數據從遠程傳遞到主機設備,但我可以從連接對象以某種方式提取它,而不需要任何數據傳輸?

在此先感謝...

+0

Vivart的答案是正確的,但它意味着你沒有看過的JSR82文檔都沒有。 這個API中有相對較少的方法,但有一個名爲RemoteDevice.getBluetoothAddress()的方法,相當明顯,這將做什麼,不是? – funkybro 2010-03-29 08:16:19

回答

3

我認爲這將有助於你

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