Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
|
Public Member Functions | |
final boolean | addDeviceToWhitelist (final BDAddressAndType addressAndType, final HCIWhitelistConnectType ctype) |
Add the given device to the adapter's autoconnect whitelist. More... | |
final boolean | addDeviceToWhitelist (final BDAddressAndType addressAndType, final HCIWhitelistConnectType ctype, final short conn_interval_min, final short conn_interval_max, final short conn_latency, final short timeout) |
Add the given device to the adapter's autoconnect whitelist. More... | |
final boolean | addStatusListener (final AdapterStatusListener l) |
Add the given AdapterStatusListener to the list if not already present. More... | |
final void | close () |
Release the native memory associated with this object The object should not be used following a call to close. More... | |
final BTDevice | connectDevice (final BDAddressAndType addressAndType) |
This method connects to device without need of performing General Discovery. More... | |
final boolean | equals (final Object obj) |
final BTDevice | find (final String name, final BDAddressAndType addressAndType) |
Find a BluetoothDevice. More... | |
final BTDevice | find (final String name, final BDAddressAndType addressAndType, final long timeoutMS) |
Find a BluetoothDevice. More... | |
final BDAddressAndType | getAddressAndType () |
Returns the adapter's public BDAddressAndType. More... | |
final native int | getBTMajorVersion () |
Returns the Bluetooth major version of this adapter. More... | |
final BTMode | getBTMode () |
Returns the current BTMode of this adapter. More... | |
final DiscoveryPolicy | getCurrentDiscoveryPolicy () |
Return the current DiscoveryPolicy , set via startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean) . More... | |
final ScanType | getCurrentScanType () |
Returns the current meta discovering ScanType . More... | |
final int | getDevID () |
Returns the BluetoothAdapter's internal temporary device id. More... | |
final List< BTDevice > | getDiscoveredDevices () |
Returns a list of discovered BluetoothDevices from this adapter. More... | |
final DBGattServer | getGATTServerData () |
Return the user's DBGattServer shared reference if in BTRole#Slave mode as set via and valid until subsequent disconnect. More... | |
final LE_Features | getLEFeatures () |
Return LE_Features for this controller. More... | |
final BTManager | getManager () |
Returns the used singleton BTManager instance, used to create this adapter. More... | |
final String | getName () |
Returns the name. More... | |
final boolean | getPoweredState () |
Returns the power state the adapter. More... | |
final BTRole | getRole () |
Return the current BTRole of this adapter. More... | |
final native boolean | getSecureConnectionsEnabled () |
Returns whether Secure Connections (SC) is enabled. More... | |
final String | getShortName () |
Returns the short name. More... | |
final BDAddressAndType | getVisibleAddressAndType () |
Returns the adapter's currently visible BDAddressAndType. More... | |
final HCIStatusCode | initialize (final BTMode btMode, final boolean powerOn) |
Initialize the adapter with default values, including power-on. More... | |
native boolean | isAdvertising () |
Returns the adapter's current advertising state. More... | |
final boolean | isDeviceWhitelisted (final BDAddressAndType addressAndType) |
Returns true, if the adapter's device is already whitelisted. More... | |
final boolean | isDiscovering () |
Returns true if the meta discovering state is not ScanType#NONE . More... | |
final native boolean | isInitialized () |
Returns true, if initialize(BTMode) has already been called for this adapter, otherwise false. More... | |
final boolean | isPowered () |
Returns whether the adapter is valid, plugged in and powered. More... | |
final boolean | isSuspended () |
Returns whether the adapter is suspended, i.e. More... | |
final boolean | isValid () |
Returns whether the adapter is valid, i.e. More... | |
final void | printDeviceLists () |
Print the internally maintained BTDevice lists to stderr: More... | |
final int | removeAllStatusListener () |
Remove all AdapterStatusListener from the list. More... | |
final boolean | removeDeviceFromWhitelist (final BDAddressAndType addressAndType) |
Remove the given device from the adapter's autoconnect whitelist. More... | |
final native boolean | removeDevicePausingDiscovery (final BTDevice device) |
Manual DiscoveryPolicy intervention point, allowing user to remove the ready device from the queue of pausing-discovery devices. More... | |
final boolean | removeDiscoveredDevice (final BDAddressAndType addressAndType) |
Discards matching discovered devices. More... | |
final int | removeDiscoveredDevices () throws BTException |
Remove all the discovered devices found on this adapter. More... | |
final boolean | removeStatusListener (final AdapterStatusListener l) |
Remove the given AdapterStatusListener from the list. More... | |
final HCIStatusCode | reset () |
Reset the adapter. More... | |
final HCIStatusCode | setDefaultConnParam (final short conn_interval_min, final short conn_interval_max, final short conn_latency, final short supervision_timeout) |
Set default connection parameter of incoming connections for this adapter when in server mode, i.e. More... | |
final HCIStatusCode | setDefaultLE_PHY (final LE_PHYs Tx, final LE_PHYs Rx) |
Sets default preference of LE_PHYs. More... | |
final HCIStatusCode | setName (final String name, final String short_name) |
Sets the name and short-name. More... | |
final native boolean | setPowered (final boolean power_on) |
Sets the power state the adapter. More... | |
final HCIStatusCode | setPrivacy (final boolean enable) |
Toggle adapter privacy address mode, i.e. More... | |
final HCIStatusCode | setSecureConnections (final boolean enable) |
Enable or disable Secure Connections (SC) of the adapter. More... | |
final void | setServerConnSecurity (final BTSecurityLevel sec_level, final SMPIOCapability io_cap) |
Sets the given ::BTSecurityLevel and ::SMPIOCapability for connecting device when in server (peripheral) mode, see adapter's role. More... | |
final native void | setSMPKeyPath (final String path) |
Set the adapter's persistent storage directory for SMPKeyBin files. More... | |
final HCIStatusCode | startAdvertising (final DBGattServer gattServerData) |
Starts advertising using all default arguments, see startAdvertising(short, short, byte, byte, byte) for details. More... | |
final HCIStatusCode | startAdvertising (final DBGattServer gattServerData_, final EInfoReport eir, final EIRDataTypeSet adv_mask, final EIRDataTypeSet scanrsp_mask, final short adv_interval_min, final short adv_interval_max, final byte adv_type, final byte adv_chan_map, final byte filter_policy) |
Starts advertising. More... | |
final HCIStatusCode | startAdvertising (final DBGattServer gattServerData_, final short adv_interval_min, final short adv_interval_max, final byte adv_type, final byte adv_chan_map, final byte filter_policy) |
Starts advertising. More... | |
final HCIStatusCode | startDiscovery () throws BTException |
Starts discovery using all default arguments, see startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean) for details. More... | |
final HCIStatusCode | startDiscovery (final DBGattServer gattServerData, final DiscoveryPolicy policy, final boolean le_scan_active, final short le_scan_interval, final short le_scan_window, final byte filter_policy, final boolean filter_dup) throws BTException |
Starts discovery. More... | |
final HCIStatusCode | startDiscovery (final DiscoveryPolicy policy, final boolean le_scan_active) throws BTException |
Starts discovery using default arguments, see startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean) for details. More... | |
final HCIStatusCode | stopAdvertising () |
Ends advertising. More... | |
final HCIStatusCode | stopDiscovery () throws BTException |
Turns off device discovery if it is enabled. More... | |
final String | toString () |
Public Member Functions inherited from jau.direct_bt.DBTObject | |
synchronized void | close () |
Release the native memory associated with this object The object should not be used following a call to close. More... | |
abstract boolean | equals (final Object obj) |
final int | hashCode () |
Public Member Functions inherited from jau.direct_bt.DBTNativeDownlink | |
final void | delete () |
Deletes the nativeInstance in the following order. More... | |
void | close () |
Release the native memory associated with this object The object should not be used following a call to close. More... | |
boolean | equals (Object obj) |
int | hashCode () |
boolean | addDeviceToWhitelist (final BDAddressAndType addressAndType, final HCIWhitelistConnectType ctype) |
Add the given device to the adapter's autoconnect whitelist. More... | |
boolean | addDeviceToWhitelist (final BDAddressAndType addressAndType, final HCIWhitelistConnectType ctype, final short conn_interval_min, final short conn_interval_max, final short conn_latency, final short timeout) |
Add the given device to the adapter's autoconnect whitelist. More... | |
boolean | addStatusListener (final AdapterStatusListener listener) |
Add the given AdapterStatusListener to the list if not already present. More... | |
BTDevice | connectDevice (BDAddressAndType addressAndType) |
This method connects to device without need of performing General Discovery. More... | |
boolean | equals (final Object obj) |
If both types are of BTAdapter , it compares their BDAddressAndType , see getAddressAndType() . More... | |
BTDevice | find (String name, BDAddressAndType addressAndType) |
Find a BluetoothDevice. More... | |
BTDevice | find (String name, BDAddressAndType addressAndType, long timeoutMS) |
Find a BluetoothDevice. More... | |
BDAddressAndType | getAddressAndType () |
Returns the adapter's public BDAddressAndType. More... | |
int | getBTMajorVersion () |
Returns the Bluetooth major version of this adapter. More... | |
BTMode | getBTMode () |
Returns the current BTMode of this adapter. More... | |
DiscoveryPolicy | getCurrentDiscoveryPolicy () |
Return the current DiscoveryPolicy , set via startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean) . More... | |
ScanType | getCurrentScanType () |
Returns the current meta discovering ScanType . More... | |
int | getDevID () |
Returns the BluetoothAdapter's internal temporary device id. More... | |
List< BTDevice > | getDiscoveredDevices () |
Returns a list of discovered BluetoothDevices from this adapter. More... | |
DBGattServer | getGATTServerData () |
Return the user's DBGattServer shared reference if in BTRole#Slave mode as set via and valid until subsequent disconnect. More... | |
LE_Features | getLEFeatures () |
Return LE_Features for this controller. More... | |
BTManager | getManager () |
Returns the used singleton BTManager instance, used to create this adapter. More... | |
String | getName () |
Returns the name. More... | |
boolean | getPoweredState () |
Returns the power state the adapter. More... | |
BTRole | getRole () |
Return the current BTRole of this adapter. More... | |
boolean | getSecureConnectionsEnabled () |
Returns whether Secure Connections (SC) is enabled. More... | |
String | getShortName () |
Returns the short name. More... | |
BDAddressAndType | getVisibleAddressAndType () |
Returns the adapter's currently visible BDAddressAndType. More... | |
HCIStatusCode | initialize (final BTMode btMode, boolean powerOn) |
Initialize the adapter with default values, including power-on. More... | |
boolean | isAdvertising () |
Returns the adapter's current advertising state. More... | |
boolean | isDeviceWhitelisted (final BDAddressAndType addressAndType) |
Returns true, if the adapter's device is already whitelisted. More... | |
boolean | isDiscovering () |
Returns true if the meta discovering state is not ScanType#NONE . More... | |
boolean | isInitialized () |
Returns true, if initialize(BTMode) has already been called for this adapter, otherwise false. More... | |
boolean | isPowered () |
Returns whether the adapter is valid, plugged in and powered. More... | |
boolean | isSuspended () |
Returns whether the adapter is suspended, i.e. More... | |
boolean | isValid () |
Returns whether the adapter is valid, i.e. More... | |
void | printDeviceLists () |
Print the internally maintained BTDevice lists to stderr: More... | |
int | removeAllStatusListener () |
Remove all AdapterStatusListener from the list. More... | |
boolean | removeDeviceFromWhitelist (final BDAddressAndType addressAndType) |
Remove the given device from the adapter's autoconnect whitelist. More... | |
boolean | removeDevicePausingDiscovery (final BTDevice device) |
Manual DiscoveryPolicy intervention point, allowing user to remove the ready device from the queue of pausing-discovery devices. More... | |
boolean | removeDiscoveredDevice (final BDAddressAndType addressAndType) |
Discards matching discovered devices. More... | |
int | removeDiscoveredDevices () throws BTException |
Remove all the discovered devices found on this adapter. More... | |
boolean | removeStatusListener (final AdapterStatusListener l) |
Remove the given AdapterStatusListener from the list. More... | |
HCIStatusCode | reset () |
Reset the adapter. More... | |
HCIStatusCode | setDefaultConnParam (final short conn_interval_min, final short conn_interval_max, final short conn_latency, final short supervision_timeout) |
Set default connection parameter of incoming connections for this adapter when in server mode, i.e. More... | |
HCIStatusCode | setDefaultLE_PHY (final LE_PHYs Tx, final LE_PHYs Rx) |
Sets default preference of LE_PHYs. More... | |
HCIStatusCode | setName (String name, String short_name) |
Sets the name and short-name. More... | |
boolean | setPowered (final boolean power_on) |
Sets the power state the adapter. More... | |
HCIStatusCode | setPrivacy (boolean enable) |
Toggle adapter privacy address mode, i.e. More... | |
HCIStatusCode | setSecureConnections (final boolean enable) |
Enable or disable Secure Connections (SC) of the adapter. More... | |
void | setServerConnSecurity (final BTSecurityLevel sec_level, final SMPIOCapability io_cap) |
Sets the given ::BTSecurityLevel and ::SMPIOCapability for connecting device when in server (peripheral) mode, see adapter's role. More... | |
void | setSMPKeyPath (final String path) |
Set the adapter's persistent storage directory for SMPKeyBin files. More... | |
HCIStatusCode | startAdvertising (final DBGattServer gattServerData) |
Starts advertising using all default arguments, see startAdvertising(short, short, byte, byte, byte) for details. More... | |
HCIStatusCode | startAdvertising (final DBGattServer gattServerData, final EInfoReport eir, final EIRDataTypeSet adv_mask, final EIRDataTypeSet scanrsp_mask, final short adv_interval_min, final short adv_interval_max, final byte adv_type, final byte adv_chan_map, final byte filter_policy) |
Starts advertising. More... | |
HCIStatusCode | startAdvertising (final DBGattServer gattServerData, final short adv_interval_min, final short adv_interval_max, final byte adv_type, final byte adv_chan_map, final byte filter_policy) |
Starts advertising. More... | |
HCIStatusCode | startDiscovery () throws BTException |
Starts discovery using all default arguments, see startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean) for details. More... | |
HCIStatusCode | startDiscovery (final DBGattServer gattServerData, final DiscoveryPolicy policy, final boolean le_scan_active, final short le_scan_interval, final short le_scan_window, final byte filter_policy, final boolean filter_dup) throws BTException |
Starts discovery. More... | |
HCIStatusCode | startDiscovery (final DiscoveryPolicy policy, final boolean le_scan_active) throws BTException |
Starts discovery using default arguments, see startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean) for details. More... | |
HCIStatusCode | stopAdvertising () |
Ends advertising. More... | |
HCIStatusCode | stopDiscovery () throws BTException |
Turns off device discovery if it is enabled. More... | |
String | toString () |
Protected Member Functions | |
native void | deleteImpl (long nativeInstance) |
Deletes the native instance. More... | |
Protected Member Functions inherited from jau.direct_bt.DBTObject | |
DBTObject (final long nativeInstance, final int hashValue) | |
void | finalize () |
Protected Member Functions inherited from jau.direct_bt.DBTNativeDownlink | |
DBTNativeDownlink () | |
DBTNativeDownlink (final long nativeInstance) | |
abstract void | deleteImpl (long nativeInstance) |
Deletes the native instance. More... | |
void | finalize () |
final void | initDownlink (final long nativeInstance) |
final boolean | isNativeValid () |
Returns true if native instance is valid, otherwise false. More... | |
Definition at line 63 of file DBTAdapter.java.
final BTManager jau.direct_bt.DBTAdapter.getManager | ( | ) |
Returns the used singleton BTManager
instance, used to create this adapter.
Implements org.direct_bt.BTAdapter.
Definition at line 109 of file DBTAdapter.java.
final BTRole jau.direct_bt.DBTAdapter.getRole | ( | ) |
Return the current BTRole
of this adapter.
Implements org.direct_bt.BTAdapter.
Definition at line 112 of file DBTAdapter.java.
final BTMode jau.direct_bt.DBTAdapter.getBTMode | ( | ) |
Returns the current BTMode
of this adapter.
Implements org.direct_bt.BTAdapter.
Definition at line 118 of file DBTAdapter.java.
final void jau.direct_bt.DBTAdapter.close | ( | ) |
Release the native memory associated with this object The object should not be used following a call to close.
Reimplemented from jau.direct_bt.DBTObject.
Definition at line 124 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.equals | ( | final Object | obj | ) |
Reimplemented from jau.direct_bt.DBTObject.
Definition at line 158 of file DBTAdapter.java.
final BDAddressAndType jau.direct_bt.DBTAdapter.getAddressAndType | ( | ) |
Returns the adapter's public BDAddressAndType.
The adapter's address as initially reported by the system is always its public address, i.e. BDAddressType#BDADDR_LE_PUBLIC
.
Implements org.direct_bt.BTAdapter.
Definition at line 171 of file DBTAdapter.java.
final BDAddressAndType jau.direct_bt.DBTAdapter.getVisibleAddressAndType | ( | ) |
Returns the adapter's currently visible BDAddressAndType.
The adapter's address as initially reported by the system is always its public address, i.e. BDAddressType#BDADDR_LE_PUBLIC
.
The adapter's visible BDAddressAndType might be set to BDAddressType#BDADDR_LE_RANDOM
before scanning / discovery mode (TODO).
Implements org.direct_bt.BTAdapter.
Definition at line 174 of file DBTAdapter.java.
final int jau.direct_bt.DBTAdapter.getDevID | ( | ) |
Returns the BluetoothAdapter's internal temporary device id.
The internal device id is constant across the adapter lifecycle, but may change after its destruction.
Implements org.direct_bt.BTAdapter.
Definition at line 177 of file DBTAdapter.java.
final native int jau.direct_bt.DBTAdapter.getBTMajorVersion | ( | ) |
Returns the Bluetooth major version of this adapter.
Currently either 4
or 5
.
Implements org.direct_bt.BTAdapter.
final String jau.direct_bt.DBTAdapter.getName | ( | ) |
Returns the name.
Can be changed via setName(String, String)
while powered-off.
Implements org.direct_bt.BTAdapter.
Definition at line 183 of file DBTAdapter.java.
final String jau.direct_bt.DBTAdapter.getShortName | ( | ) |
Returns the short name.
Can be changed via setName(String, String)
while powered-off.
Implements org.direct_bt.BTAdapter.
Definition at line 195 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.setName | ( | final String | name, |
final String | short_name | ||
) |
Sets the name and short-name.
The corresponding management event will change the name and short-name.
Shall be called while adapter is powered off, see setPowered(boolean)
. If adapter is powered, method returns HCIStatusCode#COMMAND_DISALLOWED
.
name | |
short_name |
HCIStatusCode#SUCCESS
if successful, otherwise the HCIStatusCode
error state Implements org.direct_bt.BTAdapter.
Definition at line 207 of file DBTAdapter.java.
final BTDevice jau.direct_bt.DBTAdapter.find | ( | final String | name, |
final BDAddressAndType | addressAndType, | ||
final long | timeoutMS | ||
) |
Find a BluetoothDevice.
If parameters name and address 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 name optionally specify the name of the object you are waiting for @parameter address optionally specify the MAC address of the device 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.BTAdapter.
Definition at line 213 of file DBTAdapter.java.
final BTDevice jau.direct_bt.DBTAdapter.find | ( | final String | name, |
final BDAddressAndType | addressAndType | ||
) |
Find a BluetoothDevice.
If parameters name and address 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 name optionally specify the name of the object you are waiting for @parameter address optionally specify the MAC address of the device you are waiting for
Implements org.direct_bt.BTAdapter.
Definition at line 218 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.isDeviceWhitelisted | ( | final BDAddressAndType | addressAndType | ) |
Returns true, if the adapter's device is already whitelisted.
Implements org.direct_bt.BTAdapter.
Definition at line 223 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.addDeviceToWhitelist | ( | final BDAddressAndType | addressAndType, |
final HCIWhitelistConnectType | ctype, | ||
final short | conn_interval_min, | ||
final short | conn_interval_max, | ||
final short | conn_latency, | ||
final short | timeout | ||
) |
Add the given device to the adapter's autoconnect whitelist.
The given LE connection parameter will be uploaded to the kernel for the given device first, if the device is of type BDAddressType#BDADDR_LE_PUBLIC
or BDAddressType#BDADDR_LE_RANDOM
.
Method will reject duplicate devices, in which case it should be removed first.
address | |
address_type | |
ctype | |
conn_interval_min | default value 0x000F |
conn_interval_max | default value 0x000F |
conn_latency | default value 0x0000 |
timeout | in units of 10ms, default value 1000 for 10000ms or 10s. |
true
if successful, otherwise false
.Implements org.direct_bt.BTAdapter.
Definition at line 227 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.addDeviceToWhitelist | ( | final BDAddressAndType | addressAndType, |
final HCIWhitelistConnectType | ctype | ||
) |
Add the given device to the adapter's autoconnect whitelist.
This variant of addDeviceToWhitelist(String, BDAddressType, HCIWhitelistConnectType, short, short, short, short)
uses default connection parameter, which will be uploaded to the kernel for the given device first.
Method will reject duplicate devices, in which case it should be removed first.
address | |
address_type | |
ctype |
true
if successful, otherwise false
.Implements org.direct_bt.BTAdapter.
Definition at line 239 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.removeDeviceFromWhitelist | ( | final BDAddressAndType | addressAndType | ) |
Remove the given device from the adapter's autoconnect whitelist.
Implements org.direct_bt.BTAdapter.
Definition at line 246 of file DBTAdapter.java.
final ScanType jau.direct_bt.DBTAdapter.getCurrentScanType | ( | ) |
Returns the current meta discovering ScanType
.
It can be modified through startDiscovery(DiscoveryPolicy, boolean)
and stopDiscovery()
.
Note that if startDiscovery(DiscoveryPolicy, boolean)
has been issued with keepAlive==true, the meta ScanType
will still keep the desired ScanType
enabled even if it has been temporarily disabled.
Implements org.direct_bt.BTAdapter.
Definition at line 254 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.isDiscovering | ( | ) |
Returns true if the meta discovering state is not ScanType#NONE
.
It can be modified through startDiscovery(DiscoveryPolicy, boolean)
and stopDiscovery()
.
Implements org.direct_bt.BTAdapter.
Definition at line 259 of file DBTAdapter.java.
final DBGattServer jau.direct_bt.DBTAdapter.getGATTServerData | ( | ) |
Return the user's DBGattServer shared reference if in BTRole#Slave
mode as set via and valid until subsequent disconnect.
Returns nullptr if in BTRole#Master
mode.
Implements org.direct_bt.BTAdapter.
Definition at line 264 of file DBTAdapter.java.
final String jau.direct_bt.DBTAdapter.toString | ( | ) |
Implements org.direct_bt.BTAdapter.
Definition at line 269 of file DBTAdapter.java.
final native boolean jau.direct_bt.DBTAdapter.setPowered | ( | final boolean | power_on | ) |
Sets the power state the adapter.
In case current power state is already as desired, method will not change the power state.
power_on | true will power on this adapter if it is powered-off and vice versa. |
@apiNote return value boolean since 2.0.0
Implements org.direct_bt.BTAdapter.
final HCIStatusCode jau.direct_bt.DBTAdapter.setPrivacy | ( | final boolean | enable | ) |
Toggle adapter privacy address mode, i.e.
resolvable random address including IRK.
enable | toggle to enable or disable (default) |
Implements org.direct_bt.BTAdapter.
Definition at line 286 of file DBTAdapter.java.
final native boolean jau.direct_bt.DBTAdapter.getSecureConnectionsEnabled | ( | ) |
Returns whether Secure Connections (SC) is enabled.
Implements org.direct_bt.BTAdapter.
final HCIStatusCode jau.direct_bt.DBTAdapter.setSecureConnections | ( | final boolean | enable | ) |
Enable or disable Secure Connections (SC) of the adapter.
By default, Secure Connections (SC) is enabled if supported.
Shall be called while adapter is powered off, see setPowered(boolean)
. If adapter is powered, method returns HCIStatusCode#COMMAND_DISALLOWED
.
enable |
HCIStatusCode#SUCCESS
if successful, otherwise the HCIStatusCode
error state Implements org.direct_bt.BTAdapter.
Definition at line 295 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.setDefaultConnParam | ( | final short | conn_interval_min, |
final short | conn_interval_max, | ||
final short | conn_latency, | ||
final short | supervision_timeout | ||
) |
Set default connection parameter of incoming connections for this adapter when in server mode, i.e.
In case the incoming connection's parameter don't lie within the given default values, a reconnect is being requested.
Shall be called while adapter is powered off, see setPowered(). If adapter is powered, method returns HCIStatusCode::COMMAND_DISALLOWED.
BlueZ/Linux LE connection defaults are
Supported on GNU/Linux since kernel 5.9.
dev_id | |
conn_interval_min | in units of 1.25ms, default value 8 for 10ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]. |
conn_interval_max | in units of 1.25ms, default value 40 for 50ms; Value range [6 .. 3200] for [7.5ms .. 4000ms] |
conn_latency | slave latency in units of connection events, default value 0; Value range [0 .. 0x01F3]. |
supervision_timeout | in units of 10ms, default value 500ms >= 10 x conn_interval_max, we use HCIConstInt::LE_CONN_MIN_TIMEOUT_MS minimum; Value range [0xA-0x0C80] for [100ms - 32s]. |
Implements org.direct_bt.BTAdapter.
Definition at line 301 of file DBTAdapter.java.
final void jau.direct_bt.DBTAdapter.setServerConnSecurity | ( | final BTSecurityLevel | sec_level, |
final SMPIOCapability | io_cap | ||
) |
Sets the given ::BTSecurityLevel and ::SMPIOCapability for connecting device when in server (peripheral) mode, see adapter's role.
Method either changes both parameter for the upcoming connection or none at all.
[in] | sec_level | ::BTSecurityLevel to be applied. |
[in] | io_cap | ::SMPIOCapability to be applied. |
Implements org.direct_bt.BTAdapter.
Definition at line 310 of file DBTAdapter.java.
final native void jau.direct_bt.DBTAdapter.setSMPKeyPath | ( | final String | path | ) |
Set the adapter's persistent storage directory for SMPKeyBin
files.
SMPKeyBin
instances will be managed and persistent.SMPKeyBin
instances will be transient only.When called, all keys within the path will be loaded, i.e. issuing for all keys belonging to this BTAdapter. Persistent SMPKeyBin
management is only functional when BTAdapter
is in BTRole#Slave
peripheral mode.
For each SMPKeyBin
file one shared BTDevice
in BTRole#Master
will be instantiated when uploadKeys() is called.
path | persistent storage path to SMPKeyBin files |
Implements org.direct_bt.BTAdapter.
final HCIStatusCode jau.direct_bt.DBTAdapter.initialize | ( | final BTMode | btMode, |
final boolean | powerOn | ||
) |
Initialize the adapter with default values, including power-on.
Method shall be issued on the desired adapter found via BTManager.ChangedAdapterSetListener
.
While initialization, the adapter is first powered-off, setup and then powered-on.
Calling the method will allow close() to power-off the adapter, if not powered on before.
btMode | the desired adapter's BTMode , default shall be BTMode#DUAL |
powerOn | true to leave adapter powered-on, otherwise leave it off * |
HCIStatusCode#SUCCESS
or an error state on failure (e.g. power-on) Implements org.direct_bt.BTAdapter.
Definition at line 319 of file DBTAdapter.java.
final native boolean jau.direct_bt.DBTAdapter.isInitialized | ( | ) |
Returns true, if initialize(BTMode)
has already been called for this adapter, otherwise false.
Implements org.direct_bt.BTAdapter.
final HCIStatusCode jau.direct_bt.DBTAdapter.reset | ( | ) |
Reset the adapter.
The semantics are specific to the HCI host implementation, however, it shall comply at least with the HCI Reset command and bring up the device from standby into a POWERED functional state afterwards.
BT Core Spec v5.2: Vol 4, Part E HCI: 7.3.2 Reset command
Implements org.direct_bt.BTAdapter.
Definition at line 328 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.setDefaultLE_PHY | ( | final LE_PHYs | Tx, |
final LE_PHYs | Rx | ||
) |
Sets default preference of LE_PHYs.
BT Core Spec v5.2: Vol 4, Part E, 7.8.49 LE Set PHY command
Tx | transmitter LE_PHYs bit mask of preference if not set to zero LE_PHYs#mask (ignored). |
Rx | receiver LE_PHYs bit mask of preference if not set to zero LE_PHYs#mask (ignored). |
Implements org.direct_bt.BTAdapter.
Definition at line 334 of file DBTAdapter.java.
final BTDevice jau.direct_bt.DBTAdapter.connectDevice | ( | final BDAddressAndType | addressAndType | ) |
This method connects to device without need of performing General Discovery.
Connection mechanism is similar to Connect method from Device1 interface with exception that this method returns success when physical connection is established. After this method returns, services discovery will continue and any supported profile will be connected. There is no need for calling Connect on Device1 after this call. If connection was successful this method returns object path to created device object.
address | The Bluetooth device address of the remote device. This parameter is mandatory. |
addressType | The Bluetooth device Address Type. This is address type that should be used for initial connection. If this parameter is not present BR/EDR device is created. Possible values:
|
Implements org.direct_bt.BTAdapter.
Definition at line 340 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.getPoweredState | ( | ) |
Returns the power state the adapter.
Consider using isPowered()
Implements org.direct_bt.BTAdapter.
Definition at line 346 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.isPowered | ( | ) |
Returns whether the adapter is valid, plugged in and powered.
Implements org.direct_bt.BTAdapter.
Definition at line 349 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.isSuspended | ( | ) |
Returns whether the adapter is suspended, i.e.
valid and plugged in, but not powered.
Implements org.direct_bt.BTAdapter.
Definition at line 353 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.isValid | ( | ) |
Returns whether the adapter is valid, i.e.
reference is valid, plugged in and generally operational, but not necessarily isPowered()
.
close()
'ed Implements org.direct_bt.BTAdapter.
Definition at line 357 of file DBTAdapter.java.
final LE_Features jau.direct_bt.DBTAdapter.getLEFeatures | ( | ) |
Return LE_Features
for this controller.
BT Core Spec v5.2: Vol 6, Part B, 4.6 (LE LL) Feature Support
Implements org.direct_bt.BTAdapter.
Definition at line 361 of file DBTAdapter.java.
|
protected |
Deletes the native instance.
Called via delete()
and at this point
JavaUplink
's javaObjectRef = nullptr
nativeInstance
reference has been zeroed, but passed as argument for this final native deletion task. nativeInstance | copy of nativeInstance reference, which has been already zeroed. |
Reimplemented from jau.direct_bt.DBTNativeDownlink.
final HCIStatusCode jau.direct_bt.DBTAdapter.startDiscovery | ( | ) | throws BTException |
Starts discovery using all default arguments, see startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean)
for details.
HCIStatusCode#SUCCESS
if successful, otherwise the HCIStatusCode
error state BTException |
Implements org.direct_bt.BTAdapter.
Definition at line 372 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.startDiscovery | ( | final DiscoveryPolicy | policy, |
final boolean | le_scan_active | ||
) | throws BTException |
Starts discovery using default arguments, see startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean)
for details.
policy | defaults to DiscoveryPolicy#PAUSE_CONNECTED_UNTIL_READY , see DiscoveryPolicy |
le_scan_active | true enables delivery of active scanning PDUs like EIR w/ device name (default), otherwise no scanning PDUs shall be sent. |
HCIStatusCode#SUCCESS
if successful, otherwise the HCIStatusCode
error state BTException |
Implements org.direct_bt.BTAdapter.
Definition at line 376 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.startDiscovery | ( | final DBGattServer | gattServerData, |
final DiscoveryPolicy | policy, | ||
final boolean | le_scan_active, | ||
final short | le_scan_interval, | ||
final short | le_scan_window, | ||
final byte | filter_policy, | ||
final boolean | filter_dup | ||
) | throws BTException |
Starts discovery.
Returns HCIStatusCode#SUCCESS
if successful, otherwise the HCIStatusCode
error state;
Depending on given DiscoveryPolicy
policy
, the discovery mode may be turned-off, paused until a certain readiness stage has been reached or preserved at all times. Default is DiscoveryPolicy#PAUSE_CONNECTED_UNTIL_READY
.
+ --+-------+--------+-----------+----------------------------------------------------+ | # | meta | native | keepAlive | Note +---+-------+--------+-----------+----------------------------------------------------+ | 1 | true | true | false | - | 2 | false | false | false | - +---+-------+--------+-----------+----------------------------------------------------+ | 3 | true | true | true | - | 4 | true | false | true | temporarily disabled -> startDiscoveryBackground() | 5 | false | false | true | [4] -> [5] requires manual DISCOVERING event +---+-------+--------+-----------+----------------------------------------------------+
Default parameter values are chosen for using public address resolution and usual discovery intervals etc.
Method will always clear previous discovered devices via removeDiscoveredDevices()
.
Method fails if isAdvertising().
If successful, method also changes this adapter's role to BTRole#Master
.
gattServerData_ | the DBGattServer data to be offered via GattHandler as ::GATTRole::Client. Its handles will be setup via DBGattServer::setServicesHandles(). Reference is held until next startDiscovery. |
policy | defaults to DiscoveryPolicy#PAUSE_CONNECTED_UNTIL_READY , see DiscoveryPolicy |
le_scan_active | true enables delivery of active scanning PDUs like EIR w/ device name (default), otherwise no scanning PDUs shall be sent |
le_scan_interval | in units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s] |
le_scan_window | in units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]. Shall be <= le_scan_interval |
filter_policy | 0x00 accepts all PDUs (default), 0x01 only of whitelisted, ... |
filter_dup | true to filter out duplicate AD PDUs (default), otherwise all will be reported. |
HCIStatusCode#SUCCESS
if successful, otherwise the HCIStatusCode
error state BTException |
Implements org.direct_bt.BTAdapter.
Definition at line 380 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.stopDiscovery | ( | ) | throws BTException |
Turns off device discovery if it is enabled.
HCIStatusCode#SUCCESS
if successful, otherwise the HCIStatusCode
error state @apiNote return HCIStatusCode
since 2.0.0 Implements org.direct_bt.BTAdapter.
Definition at line 406 of file DBTAdapter.java.
final DiscoveryPolicy jau.direct_bt.DBTAdapter.getCurrentDiscoveryPolicy | ( | ) |
Return the current DiscoveryPolicy
, set via startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean)
.
Implements org.direct_bt.BTAdapter.
Definition at line 420 of file DBTAdapter.java.
final native boolean jau.direct_bt.DBTAdapter.removeDevicePausingDiscovery | ( | final BTDevice | device | ) |
Manual DiscoveryPolicy
intervention point, allowing user to remove the ready device from the queue of pausing-discovery devices.
Manual intervention might be desired, if using DiscoveryPolicy#PAUSE_CONNECTED_UNTIL_DISCONNECTED
, but allowing discovery at an earlier processing step from AdapterStatusListener#deviceReady(BTDevice, long)
.
Re-enabling discovery is performed on the current thread.
device | the BTDevice to remove from the pausing-discovery queue |
BTDevice
, re-enabling discovery. Otherwise false. Implements org.direct_bt.BTAdapter.
final int jau.direct_bt.DBTAdapter.removeDiscoveredDevices | ( | ) | throws BTException |
Remove all the discovered devices found on this adapter.
BTException |
Implements org.direct_bt.BTAdapter.
Definition at line 432 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.removeDiscoveredDevice | ( | final BDAddressAndType | addressAndType | ) |
Discards matching discovered devices.
true
if found and removed, otherwise false. Implements org.direct_bt.BTAdapter.
Definition at line 455 of file DBTAdapter.java.
final List< BTDevice > jau.direct_bt.DBTAdapter.getDiscoveredDevices | ( | ) |
Returns a list of discovered BluetoothDevices from this adapter.
Implements org.direct_bt.BTAdapter.
Definition at line 482 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.addStatusListener | ( | final AdapterStatusListener | listener | ) |
Add the given AdapterStatusListener
to the list if not already present.
In case the AdapterStatusListener
's lifecycle and event delivery shall be constrained to this device, please use BTDevice#addStatusListener(AdapterStatusListener)
.
The newly added AdapterStatusListener
will receive an initial adapterSettingsChanged
event, passing an empty oldMask and changedMask
, as well as current newMask
.
This allows the receiver to be aware of this adapter's current settings.
listener | A AdapterStatusListener instance |
BTDevice#addStatusListener(AdapterStatusListener)
removeStatusListener(AdapterStatusListener)
removeAllStatusListener()
Implements org.direct_bt.BTAdapter.
Definition at line 508 of file DBTAdapter.java.
final boolean jau.direct_bt.DBTAdapter.removeStatusListener | ( | final AdapterStatusListener | l | ) |
Remove the given AdapterStatusListener
from the list.
listener | A AdapterStatusListener instance |
Implements org.direct_bt.BTAdapter.
Definition at line 519 of file DBTAdapter.java.
final int jau.direct_bt.DBTAdapter.removeAllStatusListener | ( | ) |
Remove all AdapterStatusListener
from the list.
Implements org.direct_bt.BTAdapter.
Definition at line 533 of file DBTAdapter.java.
final void jau.direct_bt.DBTAdapter.printDeviceLists | ( | ) |
Print the internally maintained BTDevice lists to stderr:
This is intended as a debug facility.
Implements org.direct_bt.BTAdapter.
Definition at line 541 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.startAdvertising | ( | final DBGattServer | gattServerData, |
final EInfoReport | eir, | ||
final EIRDataTypeSet | adv_mask, | ||
final EIRDataTypeSet | scanrsp_mask, | ||
final short | adv_interval_min, | ||
final short | adv_interval_max, | ||
final byte | adv_type, | ||
final byte | adv_chan_map, | ||
final byte | filter_policy | ||
) |
Starts advertising.
if available, otherwise using
Method fails if isDiscovering() or has any open or pending connected remote BTDevice
s.
If successful, method also changes this adapter's role to ::BTRole::Slave.
Advertising is active until either disabled via stopAdvertising()
or a connection has been made, see isAdvertising()
.
The given ADV EIR EInfoReport
will be updated with getName()
and at least GAPFlags.Bit#LE_Gen_Disc
set.
The given adv_mask and scanrsp_mask will be updated to have at least EIRDataTypeSet.DataType#FLAGS
and EIRDataTypeSet.DataType#NAME
set in total.
gattServerData_ | the DBGattServer data to be advertised and offered via GattHandler as ::GATTRole::Server. Its handles will be setup via DBGattServer::setServicesHandles(). Reference is held until next disconnect. |
eir | Full ADV EIR EInfoReport , will be updated with getName() and at least GAPFlags.Bit#LE_Gen_Disc set. |
adv_mask | EIRDataTypeSet mask for EInfoReport to select advertisement EIR PDU data, defaults to EIRDataTypeSet.DataType#FLAGS | EIRDataTypeSet.DataType#SERVICE_UUID |
scanrsp_mask | EIRDataTypeSet mask for EInfoReport to select scan-response (active scanning) EIR PDU data, defaults to EIRDataTypeSet.DataType#NAME | EIRDataTypeSet.DataType#CONN_IVAL |
adv_interval_min | in units of 0.625ms, default value 160 for 100ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s] |
adv_interval_max | in units of 0.625ms, default value 480 for 300ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s] |
adv_type | see AD_PDU_Type, default 0x00, i.e. ::AD_PDU_Type::ADV_IND |
adv_chan_map | bit 0: chan 37, bit 1: chan 38, bit 2: chan 39, default is 0x07 (all 3 channels enabled) |
filter_policy | 0x00 accepts all PDUs (default), 0x01 only of whitelisted, ... |
Implements org.direct_bt.BTAdapter.
Definition at line 707 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.startAdvertising | ( | final DBGattServer | gattServerData, |
final short | adv_interval_min, | ||
final short | adv_interval_max, | ||
final byte | adv_type, | ||
final byte | adv_chan_map, | ||
final byte | filter_policy | ||
) |
Starts advertising.
if available, otherwise using
Method fails if isDiscovering() or has any open or pending connected remote BTDevice
s.
If successful, method also changes this adapter's role to ::BTRole::Slave.
Advertising is active until either disabled via stopAdvertising()
or a connection has been made, see isAdvertising()
.
The ADV EIR EInfoReport
will be generated on the default EIRDataTypeSet
adv_mask using EIRDataTypeSet.DataType#FLAGS
| EIRDataTypeSet.DataType#SERVICE_UUID
and EIRDataTypeSet
scanrsp_mask using scan-response (active scanning) EIRDataTypeSet.DataType#NAME
| EIRDataTypeSet.DataType#CONN_IVAL
.
gattServerData_ | the DBGattServer data to be advertised and offered via GattHandler as ::GATTRole::Server. Its handles will be setup via DBGattServer::setServicesHandles(). Reference is held until next disconnect. |
adv_interval_min | in units of 0.625ms, default value 160 for 100ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s] |
adv_interval_max | in units of 0.625ms, default value 480 for 300ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s] |
adv_type | see AD_PDU_Type, default 0x00, i.e. ::AD_PDU_Type::ADV_IND |
adv_chan_map | bit 0: chan 37, bit 1: chan 38, bit 2: chan 39, default is 0x07 (all 3 channels enabled) |
filter_policy | 0x00 accepts all PDUs (default), 0x01 only of whitelisted, ... |
Implements org.direct_bt.BTAdapter.
Definition at line 728 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.startAdvertising | ( | final DBGattServer | gattServerData | ) |
Starts advertising using all default arguments, see startAdvertising(short, short, byte, byte, byte)
for details.
Advertising is active until either disabled via stopAdvertising()
or a connection has been made, see isAdvertising()
.
gattServerData_ | the DBGattServer data to be advertised and offered via GattHandler as ::GATTRole::Server. Its handles will be setup via DBGattServer::setServicesHandles(). Reference is held until next disconnect. |
Implements org.direct_bt.BTAdapter.
Definition at line 742 of file DBTAdapter.java.
final HCIStatusCode jau.direct_bt.DBTAdapter.stopAdvertising | ( | ) |
Ends advertising.
if available, otherwise using
Advertising is active until either disabled via stopAdvertising()
or a connection has been made, see isAdvertising()
.
Implements org.direct_bt.BTAdapter.
Definition at line 748 of file DBTAdapter.java.
native boolean jau.direct_bt.DBTAdapter.isAdvertising | ( | ) |
Returns the adapter's current advertising state.
It can be modified through startAdvertising(..) and stopAdvertising().
Advertising is active until either disabled via stopAdvertising()
or a connection has been made, see isAdvertising()
.
Implements org.direct_bt.BTAdapter.