BlueCove 无法连接 do Device "Permission Denied [13]"

BlueCove cannot connect do Device "Permission Denied [13]"

我正在尝试连接到蓝牙设备,在配对模式下设置目标设备时我可以配对,但尝试使用以下方法重新连接会导致错误。 导致它的代码:

StreamConnection streamConnection = null;
        try {
            streamConnection = (StreamConnection)Connector.open("btspp://A0E6F8FECB26:1;authenticate=false;encrypt=false;master=false");
            callback.onSocketCreated(streamConnection);
            callback.onConnectionSucceed();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

发生的异常

java.io.IOException: Failed to connect. [13] Permission denied
at com.intel.bluetooth.BluetoothStackBlueZ.connectionRfOpenClientConnectionImpl(Native Method)
at com.intel.bluetooth.BluetoothStackBlueZ.connectionRfOpenClientConnection(BluetoothStackBlueZ.java:574)
at com.intel.bluetooth.BluetoothRFCommClientConnection.<init>(BluetoothRFCommClientConnection.java:37)
at com.intel.bluetooth.MicroeditionConnector.openImpl(MicroeditionConnector.java:379)
at com.intel.bluetooth.MicroeditionConnector.open(MicroeditionConnector.java:162)
at javax.microedition.io.Connector.open(Connector.java:83)
at insight.utils.ConnectionEstablisher.run(ConnectionEstablisher.java:170)

我必须使用 Java,这是我为此目的找到的唯一一个库(有点用):

BlueCove version 2.1.1-SNAPSHOT on bluez

我在 Arch Linux 上使用最新的 bluez 版本,我已经尝试 无济于事。

感谢任何帮助

所以本质上,问题在于整个蓝牙堆栈/它如何将“配对请求”传播到蓝牙堆栈。

作为旁注,我在 Arch Linux 上使用 BlueZ (5.56) 并在 Java.

上使用 bluecove 库

我正在研究替代蓝牙协议栈并考虑在 Windows 10 上尝试相同的代码,它不使用 BlueZ 协议栈。

Windows 然后弹出 window 询问我是否要与此设备配对。

这是 Windows 和 Linux 之间的主要区别。 Windows/它的蓝牙堆栈或负责它的任何东西,实际上将设备注册为“已配对”。

这让我可以重新连接到设备,而不会出现任何“权限被拒绝”问题。

希望这对必须处理此库或有类似问题的任何人有所帮助。