0

我正在尝试手动午餐蓝牙堆栈(关闭蓝牙堆栈后)。

我照看BlueCoveImpl.java并发现初始化的蓝牙堆栈

private BluetoothStack detectStack()

方法,我试图通过调用来调用

BlueCoveImpl.instance().getBluetoothStack(); 

但发生异常:

Exception in thread "main" java.lang.Error: Illegal use of the JSR-82 API
    at com.intel.bluetooth.Utils.isLegalAPICall(Utils.java:296)
    at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1023)

我也试过 BlueCoveImpl.instance(); BlueCoveImpl.getThreadBluetoothStackID();

但它没有效果。

如何启动 BlueCove?

4

1 回答 1

0

方法

getBluetoothStack()

通过调用进行某种安全检查

Utils.isLegalAPICall

http://bluecove.googlecode.com/svn/trunk/bluecove/src/main/java/com/intel/bluetooth/Utils.java

此方法检查调用是否是从这些包中的类完成的

  1. javax.蓝牙。
  2. getPackage(MicroeditionConnector.class.getName())

否则它会抛出

Error("Illegal use of the JSR-82 API")

我认为调用

LocalDevice.getLocalDevice()

http://bluecove.org/bluecove/apidocs/javax/bluetooth/LocalDevice.html#getLocalDevice()

将根据需要初始化堆栈。有关Bluecove 如何确定正确堆栈以及如何使用“bluecove.stack”系统属性进行一些配置的更多信息,请参阅https://code.google.com/p/bluecove/wiki/stacks 。

于 2015-06-21T11:07:33.423 回答