Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Public Member Functions | Protected Member Functions | List of all members
jau.direct_bt.DBTAdapter Class Reference
Inheritance diagram for jau.direct_bt.DBTAdapter:
Collaboration diagram for jau.direct_bt.DBTAdapter:

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< BTDevicegetDiscoveredDevices ()
 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 ()
 
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< BTDevicegetDiscoveredDevices ()
 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 ()
 

Detailed Description

Definition at line 63 of file DBTAdapter.java.

Member Function Documentation

◆ getManager()

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.

◆ getRole()

final BTRole jau.direct_bt.DBTAdapter.getRole ( )

Return the current BTRole of this adapter.

See also
BTAdapterRoles
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 112 of file DBTAdapter.java.

◆ getBTMode()

final BTMode jau.direct_bt.DBTAdapter.getBTMode ( )

Returns the current BTMode of this adapter.

Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 118 of file DBTAdapter.java.

◆ close()

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.

Here is the caller graph for this function:

◆ equals()

final boolean jau.direct_bt.DBTAdapter.equals ( final Object  obj)

Reimplemented from jau.direct_bt.DBTObject.

Definition at line 158 of file DBTAdapter.java.

◆ getAddressAndType()

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.

Since
2.2.8
See also
getVisibleAddressAndType()

Implements org.direct_bt.BTAdapter.

Definition at line 171 of file DBTAdapter.java.

◆ getVisibleAddressAndType()

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).

Since
2.2.8
See also
getAddressAndType()

Implements org.direct_bt.BTAdapter.

Definition at line 174 of file DBTAdapter.java.

◆ getDevID()

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.

Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 177 of file DBTAdapter.java.

◆ getBTMajorVersion()

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.

◆ getName()

final String jau.direct_bt.DBTAdapter.getName ( )

Returns the name.

Can be changed via setName(String, String) while powered-off.

See also
setName(String, String)

Implements org.direct_bt.BTAdapter.

Definition at line 183 of file DBTAdapter.java.

◆ getShortName()

final String jau.direct_bt.DBTAdapter.getShortName ( )

Returns the short name.

Can be changed via setName(String, String) while powered-off.

See also
setName(String, String)
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 195 of file DBTAdapter.java.

◆ setName()

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.

Parameters
name
short_name
Returns
HCIStatusCode#SUCCESS if successful, otherwise the HCIStatusCode error state
See also
getName()
getShortName()
setPowered(boolean)
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 207 of file DBTAdapter.java.

◆ find() [1/2]

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.

Returns
An object matching the name and address or null if not found before timeout expires.

Implements org.direct_bt.BTAdapter.

Definition at line 213 of file DBTAdapter.java.

Here is the caller graph for this function:

◆ find() [2/2]

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

Returns
An object matching the name and address.

Implements org.direct_bt.BTAdapter.

Definition at line 218 of file DBTAdapter.java.

◆ isDeviceWhitelisted()

final boolean jau.direct_bt.DBTAdapter.isDeviceWhitelisted ( final BDAddressAndType  addressAndType)

Returns true, if the adapter's device is already whitelisted.

Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 223 of file DBTAdapter.java.

◆ addDeviceToWhitelist() [1/2]

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.

Parameters
address
address_type
ctype
conn_interval_mindefault value 0x000F
conn_interval_maxdefault value 0x000F
conn_latencydefault value 0x0000
timeoutin units of 10ms, default value 1000 for 10000ms or 10s.
Returns
true if successful, otherwise false.
See also
#addDeviceToWhitelist(String, BDAddressType, HCIWhitelistConnectType)
Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 227 of file DBTAdapter.java.

◆ addDeviceToWhitelist() [2/2]

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.

Parameters
address
address_type
ctype
Returns
true if successful, otherwise false.
See also
#addDeviceToWhitelist(String, BDAddressType, HCIWhitelistConnectType, short, short, short, short)
Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 239 of file DBTAdapter.java.

◆ removeDeviceFromWhitelist()

final boolean jau.direct_bt.DBTAdapter.removeDeviceFromWhitelist ( final BDAddressAndType  addressAndType)

Remove the given device from the adapter's autoconnect whitelist.

Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 246 of file DBTAdapter.java.

◆ getCurrentScanType()

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.

See also
#startDiscovery(boolean)
stopDiscovery()
Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 254 of file DBTAdapter.java.

◆ isDiscovering()

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().

See also
startDiscovery()
stopDiscovery()
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 259 of file DBTAdapter.java.

◆ getGATTServerData()

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.

◆ toString()

final String jau.direct_bt.DBTAdapter.toString ( )

Implements org.direct_bt.BTAdapter.

Definition at line 269 of file DBTAdapter.java.

Here is the caller graph for this function:

◆ setPowered()

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.

Parameters
power_ontrue will power on this adapter if it is powered-off and vice versa.
Returns
true if successfully powered-on, -off or unchanged, false on failure

@apiNote return value boolean since 2.0.0

See also
close()
#initialize(BTMode)
isInitialized()
Since
2.0.0

Implements org.direct_bt.BTAdapter.

◆ setPrivacy()

final HCIStatusCode jau.direct_bt.DBTAdapter.setPrivacy ( final boolean  enable)

Toggle adapter privacy address mode, i.e.

resolvable random address including IRK.

Parameters
enabletoggle to enable or disable (default)
Returns
HCIStatusCode::SUCCESS or an error state on failure
Since
3.2.0

Implements org.direct_bt.BTAdapter.

Definition at line 286 of file DBTAdapter.java.

◆ getSecureConnectionsEnabled()

final native boolean jau.direct_bt.DBTAdapter.getSecureConnectionsEnabled ( )

Returns whether Secure Connections (SC) is enabled.

See also
setSecureConnections(boolean)
Since
2.4.0

Implements org.direct_bt.BTAdapter.

◆ setSecureConnections()

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.

Parameters
enable
Returns
HCIStatusCode#SUCCESS if successful, otherwise the HCIStatusCode error state
See also
getSecureConnectionsEnabled()
setPowered(boolean)
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 295 of file DBTAdapter.java.

◆ setDefaultConnParam()

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.

BTRole::Slave.

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

  • conn_interval_min 24 -> 30ms
  • conn_interval_max 40 -> 50ms
  • conn_latency 0
  • supervision_timeout 42 -> 420ms

Supported on GNU/Linux since kernel 5.9.

Parameters
dev_id
conn_interval_minin units of 1.25ms, default value 8 for 10ms; Value range [6 .. 3200] for [7.5ms .. 4000ms].
conn_interval_maxin units of 1.25ms, default value 40 for 50ms; Value range [6 .. 3200] for [7.5ms .. 4000ms]
conn_latencyslave latency in units of connection events, default value 0; Value range [0 .. 0x01F3].
supervision_timeoutin 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].
Returns
HCIStatusCode::SUCCESS or an error state on failure
See also
setPowered()
Since
2.5.3

Implements org.direct_bt.BTAdapter.

Definition at line 301 of file DBTAdapter.java.

◆ setServerConnSecurity()

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.

Parameters
[in]sec_level::BTSecurityLevel to be applied.
[in]io_cap::SMPIOCapability to be applied.
See also
BTSecurityLevel
SMPIOCapability
BTDevice::setConnSecurity(BTSecurityLevel, SMPIOCapability)
startAdvertising(DBGattServer, EInfoReport, EIRDataTypeSet, EIRDataTypeSet, short, short, byte, byte, byte)

Implements org.direct_bt.BTAdapter.

Definition at line 310 of file DBTAdapter.java.

◆ setSMPKeyPath()

final native void jau.direct_bt.DBTAdapter.setSMPKeyPath ( final String  path)

Set the adapter's persistent storage directory for SMPKeyBin files.

  • if set, all SMPKeyBin instances will be managed and persistent.
  • if not set, all 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.

Parameters
pathpersistent storage path to SMPKeyBin files
See also
BTDevice::uploadKeys(SMPKeyBin, BTSecurityLevel)

Implements org.direct_bt.BTAdapter.

◆ initialize()

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.

Parameters
btModethe desired adapter's BTMode, default shall be BTMode#DUAL
powerOntrue to leave adapter powered-on, otherwise leave it off *
Returns
HCIStatusCode#SUCCESS or an error state on failure (e.g. power-on)
See also
isInitialized()
initialize()
close()
setPowered(boolean)
Since
3.2.0

Implements org.direct_bt.BTAdapter.

Definition at line 319 of file DBTAdapter.java.

◆ isInitialized()

final native boolean jau.direct_bt.DBTAdapter.isInitialized ( )

Returns true, if initialize(BTMode) has already been called for this adapter, otherwise false.

See also
#initialize(BTMode)
Since
2.4.0

Implements org.direct_bt.BTAdapter.

◆ reset()

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
Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 328 of file DBTAdapter.java.

◆ setDefaultLE_PHY()

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

Parameters
Txtransmitter LE_PHYs bit mask of preference if not set to zero LE_PHYs#mask (ignored).
Rxreceiver LE_PHYs bit mask of preference if not set to zero LE_PHYs#mask (ignored).
Returns
See also
BTDevice::getTxPhys()
BTDevice::getRxPhys()
BTDevice::getConnectedLE_PHY(LE_PHYs[], LE_PHYs[])
BTDevice::setConnectedLE_PHY(LE_PHYs, LE_PHYs)
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 334 of file DBTAdapter.java.

◆ connectDevice()

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.

Parameters
addressThe Bluetooth device address of the remote device. This parameter is mandatory.
addressTypeThe 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:
  • public - Public address
  • random - Random address

Implements org.direct_bt.BTAdapter.

Definition at line 340 of file DBTAdapter.java.

◆ getPoweredState()

final boolean jau.direct_bt.DBTAdapter.getPoweredState ( )

Returns the power state the adapter.

Consider using isPowered()

Returns
The power state of the adapter.
Since
2.0.0 Renamed from getPowered() to getPoweredState()
See also
isPowered()
isSuspended()
isValid()

Implements org.direct_bt.BTAdapter.

Definition at line 346 of file DBTAdapter.java.

◆ isPowered()

final boolean jau.direct_bt.DBTAdapter.isPowered ( )

Returns whether the adapter is valid, plugged in and powered.

Returns
true if isValid(), HCI channel open and POWERED state is set.
See also
isSuspended()
isValid()
Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 349 of file DBTAdapter.java.

◆ isSuspended()

final boolean jau.direct_bt.DBTAdapter.isSuspended ( )

Returns whether the adapter is suspended, i.e.

valid and plugged in, but not powered.

Returns
true if isValid(), HCI channel open and POWERED state is not set.
See also
isPowered()
isValid()

Implements org.direct_bt.BTAdapter.

Definition at line 353 of file DBTAdapter.java.

◆ isValid()

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().

Returns
true if this adapter references are valid and hadn't been close()'ed
See also
isPowered()
isSuspended()
Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 357 of file DBTAdapter.java.

Here is the caller graph for this function:

◆ getLEFeatures()

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
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 361 of file DBTAdapter.java.

◆ deleteImpl()

native void jau.direct_bt.DBTAdapter.deleteImpl ( long  nativeInstance)
protected

Deletes the native instance.

Called via delete() and at this point

  • this java reference has been removed from the native instance, i.e. JavaUplink's javaObjectRef = nullptr
  • the nativeInstance reference has been zeroed, but passed as argument for this final native deletion task.
Parameters
nativeInstancecopy of nativeInstance reference, which has been already zeroed.

Reimplemented from jau.direct_bt.DBTNativeDownlink.

◆ startDiscovery() [1/3]

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.

Returns
HCIStatusCode#SUCCESS if successful, otherwise the HCIStatusCode error state
Exceptions
BTException
See also
#startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean)
#getDiscovering()
DiscoveryPolicy
Since
2.5.0

Implements org.direct_bt.BTAdapter.

Definition at line 372 of file DBTAdapter.java.

Here is the caller graph for this function:

◆ startDiscovery() [2/3]

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.

Parameters
policydefaults to DiscoveryPolicy#PAUSE_CONNECTED_UNTIL_READY, see DiscoveryPolicy
le_scan_activetrue enables delivery of active scanning PDUs like EIR w/ device name (default), otherwise no scanning PDUs shall be sent.
Returns
HCIStatusCode#SUCCESS if successful, otherwise the HCIStatusCode error state
Exceptions
BTException
See also
#startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean)
#getDiscovering()
DiscoveryPolicy
Since
2.5.0

Implements org.direct_bt.BTAdapter.

Definition at line 376 of file DBTAdapter.java.

◆ startDiscovery() [3/3]

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.

Parameters
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.
policydefaults to DiscoveryPolicy#PAUSE_CONNECTED_UNTIL_READY, see DiscoveryPolicy
le_scan_activetrue enables delivery of active scanning PDUs like EIR w/ device name (default), otherwise no scanning PDUs shall be sent
le_scan_intervalin units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]
le_scan_windowin units of 0.625ms, default value 24 for 15ms; Value range [4 .. 0x4000] for [2.5ms .. 10.24s]. Shall be <= le_scan_interval
filter_policy0x00 accepts all PDUs (default), 0x01 only of whitelisted, ...
filter_duptrue to filter out duplicate AD PDUs (default), otherwise all will be reported.
Returns
HCIStatusCode#SUCCESS if successful, otherwise the HCIStatusCode error state
Exceptions
BTException
Since
3.2.0
See also
startDiscovery(DiscoveryPolicy, boolean)
isDiscovering()
isAdvertising()
DiscoveryPolicy
BTAdapterRoles

Implements org.direct_bt.BTAdapter.

Definition at line 380 of file DBTAdapter.java.

◆ stopDiscovery()

final HCIStatusCode jau.direct_bt.DBTAdapter.stopDiscovery ( ) throws BTException

Turns off device discovery if it is enabled.

Returns
HCIStatusCode#SUCCESS if successful, otherwise the HCIStatusCode error state @apiNote return HCIStatusCode since 2.0.0
Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 406 of file DBTAdapter.java.

Here is the caller graph for this function:

◆ getCurrentDiscoveryPolicy()

final DiscoveryPolicy jau.direct_bt.DBTAdapter.getCurrentDiscoveryPolicy ( )

Return the current DiscoveryPolicy, set via startDiscovery(DiscoveryPolicy, boolean, short, short, byte, boolean).

Since
2.5.1

Implements org.direct_bt.BTAdapter.

Definition at line 420 of file DBTAdapter.java.

◆ removeDevicePausingDiscovery()

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.

Parameters
devicethe BTDevice to remove from the pausing-discovery queue
Returns
true if this was the last BTDevice, re-enabling discovery. Otherwise false.
Since
2.5.1

Implements org.direct_bt.BTAdapter.

◆ removeDiscoveredDevices()

final int jau.direct_bt.DBTAdapter.removeDiscoveredDevices ( ) throws BTException

Remove all the discovered devices found on this adapter.

Returns
The number of removed discovered devices on this adapter
Exceptions
BTException
Since
2.2.0 @implNote Changed from 'removeDiscoveredDevices()' for clarity since version 2.2.0

Implements org.direct_bt.BTAdapter.

Definition at line 432 of file DBTAdapter.java.

◆ removeDiscoveredDevice()

final boolean jau.direct_bt.DBTAdapter.removeDiscoveredDevice ( final BDAddressAndType  addressAndType)

Discards matching discovered devices.

Returns
true if found and removed, otherwise false.
Since
2.2.0

Implements org.direct_bt.BTAdapter.

Definition at line 455 of file DBTAdapter.java.

◆ getDiscoveredDevices()

final List< BTDevice > jau.direct_bt.DBTAdapter.getDiscoveredDevices ( )

Returns a list of discovered BluetoothDevices from this adapter.

Returns
A list of discovered BluetoothDevices on this adapter, NULL if an error occurred

Implements org.direct_bt.BTAdapter.

Definition at line 482 of file DBTAdapter.java.

Here is the caller graph for this function:

◆ addStatusListener()

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.

Parameters
listenerA AdapterStatusListener instance
Returns
true if the given listener is not element of the list and has been newly added, otherwise false.
Since
2.3.0
See also
BTDevice#addStatusListener(AdapterStatusListener)
removeStatusListener(AdapterStatusListener)
removeAllStatusListener()

Implements org.direct_bt.BTAdapter.

Definition at line 508 of file DBTAdapter.java.

Here is the caller graph for this function:

◆ removeStatusListener()

final boolean jau.direct_bt.DBTAdapter.removeStatusListener ( final AdapterStatusListener  l)

Remove the given AdapterStatusListener from the list.

Parameters
listenerA AdapterStatusListener instance
Returns
true if the given listener is an element of the list and has been removed, otherwise false.
Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 519 of file DBTAdapter.java.

◆ removeAllStatusListener()

final int jau.direct_bt.DBTAdapter.removeAllStatusListener ( )

Remove all AdapterStatusListener from the list.

Returns
number of removed listener.
Since
2.0.0

Implements org.direct_bt.BTAdapter.

Definition at line 533 of file DBTAdapter.java.

◆ printDeviceLists()

final void jau.direct_bt.DBTAdapter.printDeviceLists ( )

Print the internally maintained BTDevice lists to stderr:

  • sharedDevices
  • connectedDevice
  • discoveredDevices
  • StatusListener

This is intended as a debug facility.

Since
2.3.0

Implements org.direct_bt.BTAdapter.

Definition at line 541 of file DBTAdapter.java.

Here is the caller graph for this function:

◆ startAdvertising() [1/3]

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.

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.53 LE Set Extended Advertising Parameters command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.54 LE Set Extended Advertising Data command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.55 LE Set Extended Scan Response Data command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.56 LE Set Extended Advertising Enable command (Bluetooth 5.0)

if available, otherwise using

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.5 LE Set Advertising Parameters command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.7 LE Set Advertising Data command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.8 LE Set Scan Response Data command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command

Method fails if isDiscovering() or has any open or pending connected remote BTDevices.

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.

Parameters
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.
eirFull ADV EIR EInfoReport, will be updated with getName() and at least GAPFlags.Bit#LE_Gen_Disc set.
adv_maskEIRDataTypeSet mask for EInfoReport to select advertisement EIR PDU data, defaults to EIRDataTypeSet.DataType#FLAGS | EIRDataTypeSet.DataType#SERVICE_UUID
scanrsp_maskEIRDataTypeSet mask for EInfoReport to select scan-response (active scanning) EIR PDU data, defaults to EIRDataTypeSet.DataType#NAME | EIRDataTypeSet.DataType#CONN_IVAL
adv_interval_minin units of 0.625ms, default value 160 for 100ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s]
adv_interval_maxin units of 0.625ms, default value 480 for 300ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s]
adv_typesee AD_PDU_Type, default 0x00, i.e. ::AD_PDU_Type::ADV_IND
adv_chan_mapbit 0: chan 37, bit 1: chan 38, bit 2: chan 39, default is 0x07 (all 3 channels enabled)
filter_policy0x00 accepts all PDUs (default), 0x01 only of whitelisted, ...
Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
See also
startAdvertising(DBGattServer, short, short, byte, byte, byte)
stopAdvertising()
isAdvertising()
isDiscovering()
BTAdapterRoles
Since
2.5.3

Implements org.direct_bt.BTAdapter.

Definition at line 707 of file DBTAdapter.java.

Here is the caller graph for this function:

◆ startAdvertising() [2/3]

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.

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.53 LE Set Extended Advertising Parameters command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.54 LE Set Extended Advertising Data command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.55 LE Set Extended Scan Response Data command (Bluetooth 5.0)
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.56 LE Set Extended Advertising Enable command (Bluetooth 5.0)

if available, otherwise using

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.5 LE Set Advertising Parameters command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.7 LE Set Advertising Data command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.8 LE Set Scan Response Data command
  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command

Method fails if isDiscovering() or has any open or pending connected remote BTDevices.

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.

Parameters
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_minin units of 0.625ms, default value 160 for 100ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s]
adv_interval_maxin units of 0.625ms, default value 480 for 300ms; Value range [0x0020 .. 0x4000] for [20ms .. 10.24s]
adv_typesee AD_PDU_Type, default 0x00, i.e. ::AD_PDU_Type::ADV_IND
adv_chan_mapbit 0: chan 37, bit 1: chan 38, bit 2: chan 39, default is 0x07 (all 3 channels enabled)
filter_policy0x00 accepts all PDUs (default), 0x01 only of whitelisted, ...
Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
See also
startAdvertising(DBGattServer, EInfoReport, EIRDataTypeSet, EIRDataTypeSet, short, short, byte, byte, byte)
startAdvertising(DBGattServer)
stopAdvertising()
isAdvertising()
isDiscovering()
BTAdapterRoles
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 728 of file DBTAdapter.java.

◆ startAdvertising() [3/3]

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().

Parameters
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.
Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
See also
startAdvertising(DBGattServer, EInfoReport, EIRDataTypeSet, EIRDataTypeSet, short, short, byte, byte, byte)
stopAdvertising()
isAdvertising()
isDiscovering()
BTAdapterRoles
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 742 of file DBTAdapter.java.

◆ stopAdvertising()

final HCIStatusCode jau.direct_bt.DBTAdapter.stopAdvertising ( )

Ends advertising.

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.56 LE Set Extended Advertising Enable command (Bluetooth 5.0)

if available, otherwise using

  • BT Core Spec v5.2: Vol 4 HCI, Part E HCI Functional: 7.8.9 LE Set Advertising Enable command

Advertising is active until either disabled via stopAdvertising() or a connection has been made, see isAdvertising().

Returns
HCIStatusCode::SUCCESS if successful, otherwise the HCIStatusCode error state
See also
#startAdvertising(short, short, byte, byte, byte)
isAdvertising()
Since
2.4.0

Implements org.direct_bt.BTAdapter.

Definition at line 748 of file DBTAdapter.java.

◆ isAdvertising()

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().

See also
#startAdvertising(short, short, byte, byte, byte)
stopAdvertising()
Since
2.4.0

Implements org.direct_bt.BTAdapter.


The documentation for this class was generated from the following file: