64ビットJVMを搭載したLinuxx64でBluecove(bluecoveとbluecove-gpl 2.1.1 SNAPSHOTライブラリの両方)を使用してペアリングプロセスでBTデバイスを認証しようとすると問題が発生します。検出は問題ないように見えますが、既知のPINで認証しようとすると、この機能が実装されていないため、ほとんどの場合、恐れることはありません。
これは実際にペアリングを行う方法です。
public Boolean pairingDevice()
{
//check if authenticated already
if (remoteDevice.isAuthenticated()){
return true;
}
else{
LOG.info("--> Pairing device");
try {
PIN = "111111";
boolean paired = RemoteDeviceHelper.authenticate(remoteDevice, PIN);
//LOG.info("Pair with " + remoteDevice.getFriendlyName(true) + (paired ? " succesfull" : " failed"));
devicePaired = paired;
if (devicePaired)
LOG.info("--> Pairing successful with device " + remoteDevice.getBluetoothAddress());
else
LOG.info("--> Pairing unsuccessful with device " + remoteDevice.getBluetoothAddress());
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
LOG.info("--> Pairing unsuccessful with device " + remoteDevice.getBluetoothAddress());
devicePaired = false;
}
LOG.info("--> Pairing device Finish");
return devicePaired;
}
}
今への呼び出し
boolean paired = RemoteDeviceHelper.authenticate(remoteDevice, PIN);
最終的にBluetoothStackBlueZ.authenticateRemoteDevice(長いアドレス、文字列パスキー)が呼び出されます。
/*
* (non-Javadoc)
*
* @see com.intel.bluetooth.BluetoothStack#authenticateRemoteDevice(long, java.lang.String)
*/
public boolean authenticateRemoteDevice(long address, String passkey) throws IOException {
return false;
}
ご覧のとおり、これは常にFALSEを返し、未定義の動作になります。質問は...Bluecoveを使用してLinuxでremoteDeviceを認証するにはどうすればよいですか?
Bluecoveに代わるものはありますか?これと同じコードがWindowsでも機能すると聞きましたが、この理由でWindowsに切り替えたくありません...
よろしくお願いします、アレックス