Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
Classes | Public Member Functions | List of all members
org.direct_bt.BTManager Interface Reference
Inheritance diagram for org.direct_bt.BTManager:
Collaboration diagram for org.direct_bt.BTManager:

Classes

interface  ChangedAdapterSetListener
 Event listener to receive change events regarding the system's BTAdapter set, e.g. More...
 
interface  Settings
 Interface allowing to retrieve certain settings of the implementation. More...
 

Public Member Functions

Settings getSettings ()
 Returns this implmentation's Settings. More...
 
BTObject find (BTType type, String name, String identifier, BTObject parent, long timeoutMS)
 Find a BluetoothObject of a type matching type. More...
 
BTObject find (BTType type, String name, String identifier, BTObject parent)
 Find a BluetoothObject of a type matching type. More...
 
List< BTAdaptergetAdapters ()
 Returns a list of BluetoothAdapters available in the system. More...
 
BTAdapter getAdapter (final int dev_id)
 Returns the BluetoothAdapter matching the given dev_id or null if not found. More...
 
List< BTDevicegetDevices ()
 Returns a list of discovered BluetoothDevices. More...
 
List< BTGattServicegetServices ()
 Returns a list of available BluetoothGattServices. More...
 
boolean setDefaultAdapter (BTAdapter adapter)
 Sets a default adapter to use for discovery. More...
 
BTAdapter getDefaultAdapter ()
 Gets the default adapter to use for discovery. More...
 
HCIStatusCode startDiscovery (final boolean keepAlive, final boolean le_scan_active) throws BTException
 Turns on device discovery on the default adapter if it is disabled. More...
 
HCIStatusCode stopDiscovery () throws BTException
 Turns off device discovery on the default adapter if it is enabled. More...
 
ScanType getCurrentScanType ()
 Returns the current meta discovering ScanType of the getDefaultAdapter() via BTAdapter#getCurrentScanType(). More...
 
void addChangedAdapterSetListener (final ChangedAdapterSetListener l)
 Add the given ChangedAdapterSetListener to this manager. More...
 
int removeChangedAdapterSetListener (final ChangedAdapterSetListener l)
 Remove the given ChangedAdapterSetListener from this manager. More...
 
void shutdown ()
 Release the native memory associated with this object and all related Bluetooth resources. More...
 

Detailed Description

Definition at line 33 of file BTManager.java.

Member Function Documentation

◆ addChangedAdapterSetListener()

void org.direct_bt.BTManager.addChangedAdapterSetListener ( final ChangedAdapterSetListener  l)

Add the given ChangedAdapterSetListener to this manager.

When a new callback is added, all available adapter's will be reported as added, this allows a fully event driven workflow.

The callback is performed on a dedicated thread, allowing the user to perform complex operations.

Since
2.0.0

Implemented in jau.direct_bt.DBTManager.

Here is the caller graph for this function:

◆ find() [1/2]

BTObject org.direct_bt.BTManager.find ( BTType  type,
String  name,
String  identifier,
BTObject  parent 
)

Find a BluetoothObject of a type matching type.

If parameters name, identifier and parent are not null, the returned object will have to match them. It will first check for existing objects. It will not turn on discovery or connect to devices. @parameter type specify the type of the object you are waiting for, NONE means anything. @parameter name optionally specify the name of the object you are waiting for (for Adapter or Device) @parameter identifier optionally specify the identifier of the object you are waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address for Adapter or Device) @parameter parent optionally specify the parent of the object you are waiting for

Returns
An object matching the name, identifier and parent.

Implemented in jau.direct_bt.DBTManager.

◆ find() [2/2]

BTObject org.direct_bt.BTManager.find ( BTType  type,
String  name,
String  identifier,
BTObject  parent,
long  timeoutMS 
)

Find a BluetoothObject of a type matching type.

If parameters name, identifier and parent are not null, the returned object will have to match them. It will first check for existing objects. It will not turn on discovery or connect to devices. @parameter type specify the type of the object you are waiting for, NONE means anything. @parameter name optionally specify the name of the object you are waiting for (for Adapter or Device) @parameter identifier optionally specify the identifier of the object you are waiting for (UUID for GattService, GattCharacteristic or GattDescriptor, address for Adapter or Device) @parameter parent optionally specify the parent of the object you are waiting for @parameter timeoutMS the function will return after timeout time in milliseconds, a value of zero means wait forever. If object is not found during this time null will be returned.

Returns
An object matching the name, identifier, parent or null if not found before timeout expires or event is canceled.

Implemented in jau.direct_bt.DBTManager.

◆ getAdapter()

BTAdapter org.direct_bt.BTManager.getAdapter ( final int  dev_id)

Returns the BluetoothAdapter matching the given dev_id or null if not found.

The adapters internal device id is constant across the adapter lifecycle, but may change after its destruction.

Parameters
dev_idthe internal temporary adapter device id
Since
2.0.0

Implemented in jau.direct_bt.DBTManager.

◆ getAdapters()

List<BTAdapter> org.direct_bt.BTManager.getAdapters ( )

Returns a list of BluetoothAdapters available in the system.

Returns
A list of BluetoothAdapters available in the system

Implemented in jau.direct_bt.DBTManager.

Here is the caller graph for this function:

◆ getCurrentScanType()

ScanType org.direct_bt.BTManager.getCurrentScanType ( )

Returns the current meta discovering ScanType of the getDefaultAdapter() via BTAdapter#getCurrentScanType().

See also
BTAdapter::getCurrentScanType()
getDefaultAdapter()
Since
2.3

Implemented in jau.direct_bt.DBTManager.

◆ getDefaultAdapter()

BTAdapter org.direct_bt.BTManager.getDefaultAdapter ( )

Gets the default adapter to use for discovery.

The default adapter is either the first powered BTAdapter, or function returns nullptr if none is enabled.

Returns
the used default adapter

Implemented in jau.direct_bt.DBTManager.

◆ getDevices()

List<BTDevice> org.direct_bt.BTManager.getDevices ( )

Returns a list of discovered BluetoothDevices.

Returns
A list of discovered BluetoothDevices

Implemented in jau.direct_bt.DBTManager.

◆ getServices()

List<BTGattService> org.direct_bt.BTManager.getServices ( )

Returns a list of available BluetoothGattServices.

Returns
A list of available BluetoothGattServices

Implemented in jau.direct_bt.DBTManager.

◆ getSettings()

Settings org.direct_bt.BTManager.getSettings ( )

Returns this implmentation's Settings.

Implemented in jau.direct_bt.DBTManager.

Here is the caller graph for this function:

◆ removeChangedAdapterSetListener()

int org.direct_bt.BTManager.removeChangedAdapterSetListener ( final ChangedAdapterSetListener  l)

Remove the given ChangedAdapterSetListener from this manager.

Parameters
lthe to be removed element
Returns
the number of removed elements
Since
2.0.0

Implemented in jau.direct_bt.DBTManager.

Here is the caller graph for this function:

◆ setDefaultAdapter()

boolean org.direct_bt.BTManager.setDefaultAdapter ( BTAdapter  adapter)

Sets a default adapter to use for discovery.

Returns
TRUE if the device was set @implNote not implemented for jau.direct_bt

Implemented in jau.direct_bt.DBTManager.

◆ shutdown()

void org.direct_bt.BTManager.shutdown ( )

Release the native memory associated with this object and all related Bluetooth resources.

The object should not be used following a call to close

Shutdown method is intended to allow a clean Bluetooth state at program exist.

Implemented in jau.direct_bt.DBTManager.

Here is the caller graph for this function:

◆ startDiscovery()

HCIStatusCode org.direct_bt.BTManager.startDiscovery ( final boolean  keepAlive,
final boolean  le_scan_active 
) throws BTException

Turns on device discovery on the default adapter if it is disabled.

Parameters
keepAliveif
true
, indicates that discovery shall be restarted if stopped by the underlying Bluetooth implementation (BlueZ, ..). Using startDiscovery(
keepAlive=true
) and stopDiscovery() is the recommended workflow for a reliable discovery process.
le_scan_activetrue enables delivery of active scanning PDUs, otherwise no scanning PDUs shall be sent (default)
Returns
HCIStatusCode#SUCCESS if successful, otherwise the HCIStatusCode error state
Exceptions
BTException
Since
2.0.0
2.2.8

Implemented in jau.direct_bt.DBTManager.

◆ stopDiscovery()

HCIStatusCode org.direct_bt.BTManager.stopDiscovery ( ) throws BTException

Turns off device discovery on the default adapter 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

Implemented in jau.direct_bt.DBTManager.


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