Bluecove中的身份验证 - Linux x64无法正常工作

时间:2012-10-15 12:52:38

标签: java linux bluecove

我在使用带有64位JVM的Linux x64中的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(长地址,String密钥)结束:

    /*
 * (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 ......

提前致谢, 亚历

1 个答案:

答案 0 :(得分:2)

对于遇到同样问题的其他人,我在几个平台上尝试过这个代码:Linux x64,Windows 7 64位,从未工作过。

我安装了Ubuntu 12.04 32位全新安装:

libbluetooth-dev和bluez-utils

工作完美......所以我的答案是......如果你需要使用Bluecove,请使用32位。无论是什么原因导致我的Linux-Windows 64机器无法正常工作...我不知道,但不能在此花费更多时间

相关问题