発生するイベントの典型的なシーケンスは次のとおりです。
- ホストデバイスはサービスを開きます(ホストデバイスはすべての着信接続を受け入れて開きます)
- リモートデバイスがホストデバイスに接続します。
- これで、ホストデバイスでスレーブ接続が開かれました。
ホストデバイスで、リモートデバイスのBluetoothアドレスを知りたい。
リモートからホストデバイスにいつでもデータとして渡すことができますが、データ転送なしで接続オブジェクトから何らかの方法で抽出できますか?
前もって感謝します...
発生するイベントの典型的なシーケンスは次のとおりです。
ホストデバイスで、リモートデバイスのBluetoothアドレスを知りたい。
リモートからホストデバイスにいつでもデータとして渡すことができますが、データ転送なしで接続オブジェクトから何らかの方法で抽出できますか?
前もって感謝します...
私はこれがあなたを助けると思います
// 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);