Direct-BT
2.3.1
Direct-BT - Direct Bluetooth Programming.
|
Public Member Functions | |
final Settings | getSettings () |
Returns this implmentation's Settings. More... | |
BTType | getBluetoothType () |
DBTObject | find (final BTType type, final String name, final String identifier, final BTObject parent, final long timeoutMS) |
Find a BluetoothObject of a type matching type. More... | |
DBTObject | find (final BTType type, final String name, final String identifier, final BTObject parent) |
Find a BluetoothObject of a type matching type. More... | |
List< BTAdapter > | getAdapters () |
Returns a list of BluetoothAdapters available in the system. More... | |
BTAdapter | getAdapter (final int dev_id) |
Returns the BluetoothAdapter matching the given dev_id or null if not found. More... | |
List< BTDevice > | getDevices () |
Returns a list of discovered BluetoothDevices. More... | |
List< BTGattService > | getServices () |
Returns a list of available BluetoothGattServices.
| |
boolean | setDefaultAdapter (final BTAdapter adapter) |
Sets a default adapter to use for discovery. More... | |
BTAdapter | getDefaultAdapter () |
Gets the default adapter to use for discovery. More... | |
HCIStatusCode | startDiscovery (final boolean keepAlive, final boolean le_scan_active) throws BTException |
Turns on device discovery on the default adapter if it is disabled. More... | |
HCIStatusCode | stopDiscovery () throws BTException |
Turns off device discovery on the default adapter if it is enabled. More... | |
final ScanType | getCurrentScanType () |
Returns the current meta discovering ScanType of the getDefaultAdapter() via BTAdapter#getCurrentScanType(). More... | |
final void | addChangedAdapterSetListener (final ChangedAdapterSetListener l) |
Add the given ChangedAdapterSetListener to this manager. More... | |
final int | removeChangedAdapterSetListener (final ChangedAdapterSetListener l) |
Remove the given ChangedAdapterSetListener from this manager. More... | |
void | shutdown () |
Release the native memory associated with this object and all related Bluetooth resources. More... | |
Static Public Member Functions | |
static final boolean | isJVMShuttingDown () |
Returns true if the JVM is shutting down, otherwise false. More... | |
static void | addShutdownHook (final boolean head, final Runnable runnable) |
Add a shutdown hook to be performed at JVM shutdown before shutting down DBTManager instance. More... | |
static boolean | getUnifyUUID128Bit () |
Returns whether uuid128_t consolidation is enabled for native uuid16_t and uuid32_t values before string conversion. More... | |
static void | setUnifyUUID128Bit (final boolean v) |
Enables or disables uuid128_t consolidation for native uuid16_t and uuid32_t values before string conversion. More... | |
static BTManager | getManager () throws RuntimeException, BTException |
Returns an instance of BluetoothManager, to be used instead of constructor. More... | |
Protected Member Functions | |
void | finalize () |
Static Protected Attributes | |
static final boolean | DEBUG = BTFactory.DEBUG |
static final boolean | VERBOSE = BTFactory.VERBOSE |
Definition at line 50 of file DBTManager.java.
final void jau.direct_bt.DBTManager.addChangedAdapterSetListener | ( | final ChangedAdapterSetListener | l | ) |
Add the given ChangedAdapterSetListener to this manager.
When a new callback is added, all available adapter's will be reported as added, this allows a fully event driven workflow.
The callback is performed on a dedicated thread, allowing the user to perform complex operations.
Implements org.direct_bt.BTManager.
Definition at line 254 of file DBTManager.java.
|
static |
Add a shutdown hook to be performed at JVM shutdown before shutting down DBTManager instance.
head | if true add runnable at the start, otherwise at the end |
runnable | runnable to be added. |
Definition at line 123 of file DBTManager.java.
|
protected |
DBTObject jau.direct_bt.DBTManager.find | ( | final BTType | type, |
final String | name, | ||
final String | identifier, | ||
final BTObject | parent | ||
) |
Find a BluetoothObject of a type matching type.
If parameters name, identifier and parent are not null, the returned object will have to match them. It will first check for existing objects. It will not turn on discovery or connect to devices. @parameter type specify the type of the object you are waiting for, NONE means anything. @parameter name optionally specify the name of the object you are waiting for (for Adapter or Device) @parameter identifier optionally specify the identifier of the object you are waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address for Adapter or Device) @parameter parent optionally specify the parent of the object you are waiting for
Implements org.direct_bt.BTManager.
Definition at line 172 of file DBTManager.java.
DBTObject jau.direct_bt.DBTManager.find | ( | final BTType | type, |
final String | name, | ||
final String | identifier, | ||
final BTObject | parent, | ||
final long | timeoutMS | ||
) |
Find a BluetoothObject of a type matching type.
If parameters name, identifier and parent are not null, the returned object will have to match them. It will first check for existing objects. It will not turn on discovery or connect to devices. @parameter type specify the type of the object you are waiting for, NONE means anything. @parameter name optionally specify the name of the object you are waiting for (for Adapter or Device) @parameter identifier optionally specify the identifier of the object you are waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address for Adapter or Device) @parameter parent optionally specify the parent of the object you are waiting for @parameter timeoutMS the function will return after timeout time in milliseconds, a value of zero means wait forever. If object is not found during this time null will be returned.
Implements org.direct_bt.BTManager.
Definition at line 167 of file DBTManager.java.
BTAdapter jau.direct_bt.DBTManager.getAdapter | ( | final int | dev_id | ) |
Returns the BluetoothAdapter matching the given dev_id or null if not found.
The adapters internal device id is constant across the adapter lifecycle, but may change after its destruction.
dev_id | the internal temporary adapter device id |
Implements org.direct_bt.BTManager.
Definition at line 180 of file DBTManager.java.
List<BTAdapter> jau.direct_bt.DBTManager.getAdapters | ( | ) |
Returns a list of BluetoothAdapters available in the system.
Implements org.direct_bt.BTManager.
Definition at line 177 of file DBTManager.java.
BTType jau.direct_bt.DBTManager.getBluetoothType | ( | ) |
Definition at line 164 of file DBTManager.java.
final ScanType jau.direct_bt.DBTManager.getCurrentScanType | ( | ) |
Returns the current meta discovering ScanType of the getDefaultAdapter() via BTAdapter#getCurrentScanType().
Implements org.direct_bt.BTManager.
Definition at line 249 of file DBTManager.java.
BTAdapter jau.direct_bt.DBTManager.getDefaultAdapter | ( | ) |
Gets the default adapter to use for discovery.
The default adapter is either the first powered BTAdapter, or function returns nullptr if none is enabled.
Implements org.direct_bt.BTManager.
Definition at line 230 of file DBTManager.java.
List<BTDevice> jau.direct_bt.DBTManager.getDevices | ( | ) |
Returns a list of discovered BluetoothDevices.
Implements org.direct_bt.BTManager.
Definition at line 191 of file DBTManager.java.
|
static |
Returns an instance of BluetoothManager, to be used instead of constructor.
Definition at line 398 of file DBTManager.java.
List<BTGattService> jau.direct_bt.DBTManager.getServices | ( | ) |
Returns a list of available BluetoothGattServices.
This call could be a quite expensive service query, see below.
This implementation returns all BTGattService from all BTDevices from the getDefaultAdapter() using BTDevice#getServices().
This implementation does not start an explicit discovery, but previous discovered devices are being queried.
Implements org.direct_bt.BTManager.
Definition at line 208 of file DBTManager.java.
final Settings jau.direct_bt.DBTManager.getSettings | ( | ) |
Returns this implmentation's Settings.
Implements org.direct_bt.BTManager.
Definition at line 162 of file DBTManager.java.
|
static |
Returns whether uuid128_t consolidation is enabled for native uuid16_t and uuid32_t values before string conversion.
Definition at line 140 of file DBTManager.java.
|
static |
Returns true if the JVM is shutting down, otherwise false.
Definition at line 115 of file DBTManager.java.
final int jau.direct_bt.DBTManager.removeChangedAdapterSetListener | ( | final ChangedAdapterSetListener | l | ) |
Remove the given ChangedAdapterSetListener from this manager.
l | the to be removed element |
Implements org.direct_bt.BTManager.
Definition at line 266 of file DBTManager.java.
boolean jau.direct_bt.DBTManager.setDefaultAdapter | ( | final BTAdapter | adapter | ) |
Sets a default adapter to use for discovery.
Implements org.direct_bt.BTManager.
Definition at line 225 of file DBTManager.java.
|
static |
Enables or disables uuid128_t consolidation for native uuid16_t and uuid32_t values before string conversion.
Default is
.
If desired, this value should be set once before the first call of getManager()!
Definition at line 153 of file DBTManager.java.
void jau.direct_bt.DBTManager.shutdown | ( | ) |
Release the native memory associated with this object and all related Bluetooth resources.
The object should not be used following a call to close
Shutdown method is intended to allow a clean Bluetooth state at program exist.
Implements org.direct_bt.BTManager.
Definition at line 412 of file DBTManager.java.
HCIStatusCode jau.direct_bt.DBTManager.startDiscovery | ( | final boolean | keepAlive, |
final boolean | le_scan_active | ||
) | throws BTException |
Turns on device discovery on the default adapter if it is disabled.
keepAlive | if true
keepAlive=true
|
le_scan_active | true enables delivery of active scanning PDUs, otherwise no scanning PDUs shall be sent (default) |
BTException |
Implements org.direct_bt.BTManager.
Definition at line 241 of file DBTManager.java.
HCIStatusCode jau.direct_bt.DBTManager.stopDiscovery | ( | ) | throws BTException |
Turns off device discovery on the default adapter if it is enabled.
Implements org.direct_bt.BTManager.
Definition at line 246 of file DBTManager.java.
|
staticprotected |
Definition at line 52 of file DBTManager.java.
|
staticprotected |
Definition at line 53 of file DBTManager.java.