public class BluetoothServiceDefinition extends Object
BluetoothServiceDefinition
class represents the structure of a GATT service.
Service definitions may be created by using the class constructor
.
This class provides methods to add characteristics and descriptors to the service definition.
Constructor and Description |
---|
BluetoothServiceDefinition(BluetoothUuid serviceUuid)
Creates a service definition.
|
Modifier and Type | Method and Description |
---|---|
void |
addCharacteristic(BluetoothUuid uuid,
int properties,
int permissions)
Adds a characteristic to this service definition.
|
void |
addDescriptor(BluetoothUuid uuid,
int permissions)
Adds a descriptor to this service definition.
|
public BluetoothServiceDefinition(BluetoothUuid serviceUuid)
serviceUuid
- the UUID of the service.public void addCharacteristic(BluetoothUuid uuid, int properties, int permissions)
uuid
- the UUID of the characteristic.properties
- the properties of the characteristic (see BluetoothProperties
.permissions
- the permissions of the characteristic (see BluetoothPermissions
.public void addDescriptor(BluetoothUuid uuid, int permissions)
characteristic added
.uuid
- the UUID of the descriptor.permissions
- the permissions of the descriptor (see BluetoothPermissions
.IllegalStateException
- if no characteristic has been added before calling this method.