Package ej.bluetooth
Class BluetoothServiceDefinition
- java.lang.Object
-
- ej.bluetooth.BluetoothServiceDefinition
-
public class BluetoothServiceDefinition extends Object
TheBluetoothServiceDefinitionclass 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 Summary
Constructors Constructor Description BluetoothServiceDefinition(BluetoothUuid serviceUuid)Creates a service definition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCharacteristic(BluetoothUuid uuid, int properties, int permissions)Adds a characteristic to this service definition.voidaddDescriptor(BluetoothUuid uuid, int permissions)Adds a descriptor to this service definition.
-
-
-
Constructor Detail
-
BluetoothServiceDefinition
public BluetoothServiceDefinition(BluetoothUuid serviceUuid)
Creates a service definition.- Parameters:
serviceUuid- the UUID of the service.
-
-
Method Detail
-
addCharacteristic
public void addCharacteristic(BluetoothUuid uuid, int properties, int permissions)
Adds a characteristic to this service definition.- Parameters:
uuid- the UUID of the characteristic.properties- the properties of the characteristic (seeBluetoothProperties.permissions- the permissions of the characteristic (seeBluetoothPermissions.
-
addDescriptor
public void addDescriptor(BluetoothUuid uuid, int permissions)
Adds a descriptor to this service definition. The descriptor is attached to the lastcharacteristic added.- Parameters:
uuid- the UUID of the descriptor.permissions- the permissions of the descriptor (seeBluetoothPermissions.- Throws:
IllegalStateException- if no characteristic has been added before calling this method.
-
-