【问题标题】:Authentication in Bluecove - Linux x64 not workingBluecove 中的身份验证 - Linux x64 不起作用
【发布时间】:2014-08-09 18:25:52
【问题描述】:

我在尝试使用带有 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(long address, String passkey) 结束:

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

提前致谢, 亚历克斯

【问题讨论】:

标签: java linux bluecove


【解决方案1】:

对于遇到同样问题的其他人,我已经在多个平台上尝试过此代码:Linux x64、Windows 7 64 位,但从未成功。

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

libbluetooth-dev 和 bluez-utils

完美运行...所以我的答案是...如果您需要使用 Bluecove,请使用 32 位。不管是什么原因,这在我的 Linux-Windows 64 机器上都不起作用……我不知道,但不能在这上面花更多时间

【讨论】:

  • 附带说明,我还应该说,我只能使用 bluecove 和 bluecovez SNAPSHOT 库 (snapshot.bluecove.org/distribution/download/2.1.1-SNAPSHOT) 使其工作。 bluecove-gpl 从来没有为我工作过,在尝试配对设备时总是失败。除了 bluecovez,你还需要 libbluetooth-dev、bluez-utils、dbus、hexdumd 和 unixsockets,你可以在这里找到它们:code.google.com/p/blufeedme/source/browse/trunk/src/BlufeedmeBT/…。此外,我每次尝试都必须关闭/打开,否则在搜索设备或服务时会出现查询错误....为什么?不知道
  • 完全理解这是否太久以前您无法帮助我,但我遇到了同样的问题,无法弄清楚如何让非 gpl 版本在我的电脑上运行机器。我假设您的意思是 bluecove-bluez 库,而不是 bluecovez(它没有出现在快照链接中),但除此之外,您如何为您所在的机器编译它?在 gpl 版本中,使用 ant 非常简单。或者,你有没有发现比 bluecove 更好的东西?
  • 对不起@HarveyAdcock,我没有用于此的资源,也没有用于此的蓝牙设备...所以我无能为力:(
猜你喜欢
  • 2012-10-04
  • 1970-01-01
  • 2012-04-29
  • 2012-03-18
  • 2011-07-05
  • 2013-12-02
  • 2013-06-29
相关资源
最近更新 更多