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

Representing a Gatt Service object from the GATT client perspective. More...

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

Public Member Functions

BTGattChar findGattChar (String char_uuid)
 Find a BTGattChar by its char_uuid. More...
 
List< BTGattChargetChars ()
 Returns a list of BTGattChar this service exposes. 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...
 
String getUUID ()
 Get the UUID of this service. More...
 
String toString ()
 
- Public Member Functions inherited from org.direct_bt.BTObject
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 ()
 

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 int removeAllCharListener (final BTDevice device, final List< BTGattService > services)
 Removes all BTGattCharListener from the BTDevice. More...
 
static boolean removeCharListenerFromAll (final BTDevice device, final List< BTGattService > services, final BTGattCharListener listener)
 Removes the given BTGattCharListener from the BTDevice. More...
 

Detailed Description

Representing a Gatt Service object from the GATT client perspective.

A list of shared BTGattService instances can be retrieved from BTDevice after successful connection and optional pairing via BTDevice::getGattServices().

See Direct-BT Overview.

BT Core Spec v5.2: Vol 3, Part G GATT: 3.1 Service Definition

Includes a complete [Primary] Service Declaration including its list of Characteristic Declarations, which also may include its client config if available.

See DBGattService.UUID16 for selected standard GATT service numbers in UUID16 format and BTUtils#toUUID128(String) for their conversion to UUID128.

Definition at line 48 of file BTGattService.java.

Member Function Documentation

◆ findGattChar()

BTGattChar org.direct_bt.BTGattService.findGattChar ( String  char_uuid)

Find a BTGattChar by its char_uuid.

@parameter char_uuid the UUID of the desired BTGattChar

Returns
The matching characteristic or null if not found

Implemented in jau.direct_bt.DBTGattService.

Here is the caller graph for this function:

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

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

◆ 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:

◆ 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 91 of file BTGattService.java.

◆ 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 115 of file BTGattService.java.

◆ removeAllCharListener()

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

◆ toString()

String org.direct_bt.BTGattService.toString ( )

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