0

I'm trying to lunch bluetooth stack manually(after closing bluetooh stack).

I look after BlueCoveImpl.java and find out that bluetooth stack initialized in

private BluetoothStack detectStack()

method, which I trying to call by calling

BlueCoveImpl.instance().getBluetoothStack(); 

but exception occures:

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)

I also tried BlueCoveImpl.instance(); BlueCoveImpl.getThreadBluetoothStackID();

but it made no effect.

How can I launch BlueCove?

Cœur
  • 37,241
  • 25
  • 195
  • 267
IKM2007
  • 716
  • 1
  • 8
  • 31

1 Answers1

0

The method

getBluetoothStack()

does some sort of security check by calling

Utils.isLegalAPICall

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

This method checks if the call is done from a class out of these packages

  1. javax.bluetooth.
  2. getPackage(MicroeditionConnector.class.getName())

otherwise it throws

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

I think that calling

LocalDevice.getLocalDevice()

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

will initialize the stack as needed. See https://code.google.com/p/bluecove/wiki/stacks for more information about how Bluecove will determine the correct stack and how you can do some configuration using the "bluecove.stack" system property.

Shelltux
  • 130
  • 2
  • 10