Direct-BT  2.3.1
Direct-BT - Direct Bluetooth Programming.
Public Member Functions | Static Public Member Functions | List of all members
org.direct_bt.BTGattService Interface Reference

Provides access to Bluetooth GATT characteristic. More...

Inheritance diagram for org.direct_bt.BTGattService:
Collaboration diagram for org.direct_bt.BTGattService:

Public Member Functions

BTGattChar find (String UUID, long timeoutMS)
 Find a BTGattChar. More...
 
BTGattChar find (String UUID)
 Find a BTGattChar. More...
 
String getUUID ()
 Get the UUID of this service. More...
 
BTDevice getDevice ()
 Returns the device to which this service belongs to. More...
 
boolean getPrimary ()
 Returns true if this service is a primary service, false if secondary. More...
 
List< BTGattChargetChars ()
 Returns a list of BTGattChar this service exposes. More...
 
- Public Member Functions inherited from org.direct_bt.BTObject
BTType getBluetoothType ()
 Returns the BluetoothType of this object. More...
 
boolean equals (Object obj)
 
int hashCode ()
 
void close ()
 Release the native memory associated with this object The object should not be used following a call to close. More...
 

Static Public Member Functions

static boolean addCharListenerToAll (final BTDevice device, final List< BTGattService > services, final BTGattCharListener listener)
 Adds the given BTGattCharListener to the BTDevice and BTGattChar#enableNotificationOrIndication(boolean[]) for all BTGattChar instances. More...
 
static boolean removeCharListenerFromAll (final BTDevice device, final List< BTGattService > services, final BTGattCharListener listener)
 Removes the given BTGattCharListener from the BTDevice. More...
 
static int removeAllCharListener (final BTDevice device, final List< BTGattService > services)
 Removes all BTGattCharListener from the BTDevice. More...
 

Detailed Description

Provides access to Bluetooth GATT characteristic.

See also
Bluetooth Specification
BlueZ GATT API

Definition at line 40 of file BTGattService.java.

Member Function Documentation

◆ addCharListenerToAll()

static boolean org.direct_bt.BTGattService.addCharListenerToAll ( final BTDevice  device,
final List< BTGattService services,
final BTGattCharListener  listener 
)
static

Adds the given BTGattCharListener to the BTDevice and BTGattChar#enableNotificationOrIndication(boolean[]) for all BTGattChar instances.

Parameters
listenerBTGattCharListener to add to the BTDevice. It is important to have hte listener's associated characteristic == null, otherwise the listener can't be used for all characteristics.
Returns
true if successful, otherwise false
Exceptions
IllegalArgumentExceptionif listener's associated characteristic is not null.
Since
2.0.0
See also
BTGattChar::enableNotificationOrIndication(boolean[])
BTDevice::addCharListener(BTGattCharListener, BTGattChar)

Definition at line 101 of file BTGattService.java.

Here is the call graph for this function:

◆ find() [1/2]

BTGattChar org.direct_bt.BTGattService.find ( String  UUID)

Find a BTGattChar.

If parameter UUID is not null, the returned object will have to match it. It will first check for existing objects. It will not turn on discovery or connect to devices. @parameter UUID optionally specify the UUID of the BluetoothGattDescriptor you are waiting for

Returns
An object matching the UUID or null if not found before timeout expires or event is canceled.

Implemented in jau.direct_bt.DBTGattService.

◆ find() [2/2]

BTGattChar org.direct_bt.BTGattService.find ( String  UUID,
long  timeoutMS 
)

Find a BTGattChar.

If parameter UUID is not null, the returned object will have to match it. It will first check for existing objects. It will not turn on discovery or connect to devices. @parameter UUID optionally specify the UUID of the BTGattChar 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 UUID or null if not found before timeout expires or event is canceled.

Implemented in jau.direct_bt.DBTGattService.

◆ getChars()

List<BTGattChar> org.direct_bt.BTGattService.getChars ( )

Returns a list of BTGattChar this service exposes.

Returns
A list of BTGattChar exposed by this service

Implemented in jau.direct_bt.DBTGattService.

Here is the caller graph for this function:

◆ getDevice()

BTDevice org.direct_bt.BTGattService.getDevice ( )

Returns the device to which this service belongs to.

Returns
The device.

Implemented in jau.direct_bt.DBTGattService.

Here is the caller graph for this function:

◆ getPrimary()

boolean org.direct_bt.BTGattService.getPrimary ( )

Returns true if this service is a primary service, false if secondary.

Returns
true if this service is a primary service, false if secondary.

Implemented in jau.direct_bt.DBTGattService.

◆ getUUID()

String org.direct_bt.BTGattService.getUUID ( )

Get the UUID of this service.

Returns
The 128 byte UUID of this service, NULL if an error occurred

Implemented in jau.direct_bt.DBTGattService.

◆ removeAllCharListener()

static int org.direct_bt.BTGattService.removeAllCharListener ( final BTDevice  device,
final List< BTGattService services 
)
static

Removes all BTGattCharListener from the BTDevice.

Returns
count of removed BTGattCharListener
Since
2.0.0
See also
BTGattChar::configNotificationIndication(boolean, boolean, boolean[])
BTDevice::removeAllCharListener()

Definition at line 147 of file BTGattService.java.

Here is the call graph for this function:

◆ removeCharListenerFromAll()

static boolean org.direct_bt.BTGattService.removeCharListenerFromAll ( final BTDevice  device,
final List< BTGattService services,
final BTGattCharListener  listener 
)
static

Removes the given BTGattCharListener from the BTDevice.

Parameters
listenerBTGattCharListener to remove from the BTDevice.
Returns
true if successful, otherwise false
Since
2.0.0
See also
BTGattChar::configNotificationIndication(boolean, boolean, boolean[])
BTDevice::removeCharListener(BTGattCharListener)

Definition at line 128 of file BTGattService.java.

Here is the call graph for this function:

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