|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.intel.bluetooth.BlueCoveImpl
public class BlueCoveImpl
Singleton class used as holder for BluetoothStack. Under security manager all you need to do is initialize BlueCoveImpl inside Privileged context.
If automatic Bluetooth Stack detection is not enough Java System property "bluecove.stack" can be used to force desired Stack Initialization. Values "widcomm", "bluesoleil" or "winsock". By default winsock is selected if available.
Another property "bluecove.stack.first" is used optimize stack detection. If -Dbluecove.stack.first=widcomm then widcomm (bluecove.dll) stack is loaded first and if not available then BlueCove will switch to winsock. By default intelbth.dll is loaded first.
If multiple stacks are detected they are selected in following order: "winsock", "widcomm", "bluesoleil". Since BlueCove v2.0.1 "bluecove.stack.first" will alter the order of stack selection.
To use jsr-82 emulator set "bluecove.stack" value to "emulator".
If System property is not an option (e.g. when running in Webstart) create text file "bluecove.stack" or "bluecove.stack.first" containing stack name and add this file to BlueCove or Application jar. (Since v2.0.1)
Use `LocalDevice.getProperty("bluecove.stack")` to find out which stack is used.
| Field Summary | |
|---|---|
static int |
BLUECOVE_STACK_DETECT_BLUEZ
|
static int |
BLUECOVE_STACK_DETECT_EMULATOR
|
static String |
NATIVE_LIB_BLUESOLEIL
To work on BlueSoleil version 2.3 we need to compile C++ code /MT the same as winsock. |
static String |
NATIVE_LIB_BLUEZ
|
static String |
NATIVE_LIB_MS
|
static String |
NATIVE_LIB_OSX
|
static String |
NATIVE_LIB_TOSHIBA
|
static String |
NATIVE_LIB_WIDCOMM
|
static int |
nativeLibraryVersionExpected
|
static String |
STACK_BLUESOLEIL
|
static String |
STACK_BLUEZ
|
static String |
STACK_EMULATOR
|
static String |
STACK_OSX
|
static String |
STACK_TOSHIBA
|
static String |
STACK_WIDCOMM
|
static String |
STACK_WINSOCK
|
static String |
version
|
static int |
versionBuild
|
static int |
versionMajor1
|
static int |
versionMajor2
|
static int |
versionMinor
|
static String |
versionSufix
|
| Method Summary | |
|---|---|
void |
enableNativeDebug(boolean on)
|
BluetoothStack |
getBluetoothStack()
Applications should not used this function. |
static Object |
getCurrentThreadBluetoothStackID()
Returns the ID to be used in other threads accessing the same stack. |
String |
getLocalDeviceFeature(int featureID)
|
static Vector |
getLocalDevicesID()
List the local adapters that can be initialized using configuration property "bluecove.deviceID". |
static Object |
getThreadBluetoothStackID()
Initialize BluetoothStack if not already done and returns the ID to be used in other threads accessing the same stack. |
static BlueCoveImpl |
instance()
Applications should not used this function. |
static void |
releaseThreadBluetoothStack()
Detach BluetoothStack from ThreadLocal. |
String |
setBluetoothStack(String stack)
Deprecated. use setConfigProperty("bluecove.stack", ...); |
static void |
setConfigProperty(String name,
String value)
API that can be used to configure BlueCove properties instead of System properties. |
static void |
setDefaultThreadBluetoothStackID(Object stackID)
Set default Thread BluetoothStack for Threads that do not call setThreadBluetoothStackID(stackID). |
static void |
setThreadBluetoothStackID(Object stackID)
Updates the current Thread BluetoothStack. |
static void |
shutdown()
Shutdown all BluetoothStacks interfaces initialized by BlueCove |
static void |
shutdownThreadBluetoothStack()
Shutdown BluetoothStack assigned for current Thread and clear configuration properties for this thread |
static void |
useThreadLocalBluetoothStack()
API that enables the use of Multiple Adapters and Bluetooth Stacks in parallel in the same JVM. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int versionMajor1
public static final int versionMajor2
public static final int versionMinor
public static final int versionBuild
public static final String versionSufix
public static final String version
public static final int nativeLibraryVersionExpected
public static final String STACK_WINSOCK
public static final String STACK_WIDCOMM
public static final String STACK_BLUESOLEIL
public static final String STACK_TOSHIBA
public static final String STACK_BLUEZ
public static final String STACK_OSX
public static final String STACK_EMULATOR
public static final String NATIVE_LIB_MS
public static final String NATIVE_LIB_WIDCOMM
public static final String NATIVE_LIB_TOSHIBA
public static final String NATIVE_LIB_BLUEZ
public static final String NATIVE_LIB_OSX
public static final String NATIVE_LIB_BLUESOLEIL
public static final int BLUECOVE_STACK_DETECT_BLUEZ
public static final int BLUECOVE_STACK_DETECT_EMULATOR
| Method Detail |
|---|
public static BlueCoveImpl instance()
public static Vector getLocalDevicesID()
throws BluetoothStateException
BluetoothStateException - if stack interface can't be initializedBlueCoveConfigProperties.PROPERTY_LOCAL_DEVICE_ID,
BlueCoveLocalDeviceProperties.LOCAL_DEVICE_PROPERTY_DEVICE_IDpublic static void useThreadLocalBluetoothStack()
LocalDevice.getLocalDevice(); LocalDevice.getProperty(String); Connector.open(...); methods of RemoteDevice instance created by user.Example
BlueCoveImpl.useThreadLocalBluetoothStack();
// On Windows
BlueCoveImpl.setConfigProperty("bluecove.stack", "widcomm");
// On Linux or in Emulator
// BlueCoveImpl.setConfigProperty("bluecove.deviceID", "0");
final Object id1 = BlueCoveImpl.getThreadBluetoothStackID();
... do some work with stack 1
// Illustrates attaching thread to already initialized stack interface
Thread t1 = new Thread() {
public void run() {
BlueCoveImpl.setThreadBluetoothStackID(id1);
agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
agent.startInquiry(...);
.....
}
};
t1.start();
// Illustrates initialization of new/different stack interface in new thread
// Start another thread that is using different stack
Thread t2 = new Thread() {
public void run() {
// On Windows
BlueCoveImpl.setConfigProperty("bluecove.stack", "winsock");
// On Linux or in Emulator
// BlueCoveImpl.setConfigProperty("bluecove.deviceID", "1");
agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
agent.startInquiry(...);
.....
}
}
t2.start();
Thread t3 = new Thread() {
public void run() {
// Wrong, will produce error: Thread StackID not configured
Connector.open("btspp://12345678:1");
.....
}
};
t3.start();
setConfigProperty(java.lang.String, java.lang.String)
public static Object getThreadBluetoothStackID()
throws BluetoothStateException
setThreadBluetoothStackID
BluetoothStateException - if the Bluetooth system could not be initializedpublic static Object getCurrentThreadBluetoothStackID()
setThreadBluetoothStackID or
null if ThreadLocalBluetoothStack not used.public static void setThreadBluetoothStackID(Object stackID)
stackID was obtained using the
getThreadBluetoothStackID() method. Should be called before
connection is made or LocalDevice received from
LocalDevice.getLocalDevice().
stackID - stackID to use or null to detach the current
Threadpublic static void releaseThreadBluetoothStack()
public static void setDefaultThreadBluetoothStackID(Object stackID)
setThreadBluetoothStackID(stackID). Updating is possible
only if stackID was obtained using the
getThreadBluetoothStackID() method.
stackID - stackID to use or null to remove defaultpublic static void shutdownThreadBluetoothStack()
public static void shutdown()
public static void setConfigProperty(String name,
String value)
null is passed as the value
then the property will be removed.
name - property namevalue - property value
IllegalArgumentException - if the stack already initialized and property can't be
changed.BlueCoveConfigProperties
public String getLocalDeviceFeature(int featureID)
throws BluetoothStateException
BluetoothStateException
public String setBluetoothStack(String stack)
throws BluetoothStateException
stack -
BluetoothStateExceptionpublic void enableNativeDebug(boolean on)
public BluetoothStack getBluetoothStack()
throws BluetoothStateException
BluetoothStateException - when BluetoothStack not detected. If one connected the
hardware later, BlueCove would be able to recover and start
correctly
Error - if called from outside of BlueCove internal code.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||