【发布时间】:2021-11-08 14:31:57
【问题描述】:
我正在尝试连接蓝牙设备,在将目标设备设置为配对模式时可以配对,但尝试使用以下方法重新连接会导致错误。 导致它的代码:
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 版本,我已经尝试过 This Fix 无济于事。
感谢任何帮助
【问题讨论】:
标签: java exception bluetooth bluecove