3

BlueCove 2.1.1用の RemoteDeviceDiscovery サンプル プロジェクトをビルドして実行しました。プログラムは検出可能なすべての Bluetooth デバイスを検出しますが、以前にペアリングされた deviceDiscovered() デバイスも報告します。

(Android のように) 周囲のデバイスのみを検出する方法はありますか? 以下のコードは、検出されたデバイスとペアリングされたデバイスの両方を返します...

public void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod) {
            System.out.println("Device " + btDevice.getBluetoothAddress() + " found");
            devicesDiscovered.addElement(btDevice);
            try {
                System.out.println("     name " + btDevice.getFriendlyName(false));
            } catch (IOException cantGetDeviceName) {
            }
        }
4

1 に答える 1

0

はい - http://bluecove.org/bluecove/apidocs/javax/bluetooth/RemoteDevice.html#isTrustedDevice()を使用して、ペアリングされていないデバイス (または必要に応じてペアリングされたデバイス) をフィルタリングします。

于 2015-06-13T13:10:44.687 に答える