Package ej.bluetooth

## Class BluetoothServiceDefinition

- java.lang.Object
- - ej.bluetooth.BluetoothServiceDefinition

-     public class BluetoothServiceDefinition
      extends Object

  The `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 Summary

    Constructors
    Constructor | Description
    --- | ---
    `BluetoothServiceDefinition​(BluetoothUuid serviceUuid)` | Creates a service definition.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | 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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 (see `BluetoothProperties`.
        `permissions` - the permissions of the characteristic (see `BluetoothPermissions`.

    - #### addDescriptor

          public void addDescriptor​(BluetoothUuid uuid,
                                    int permissions)

      Adds a descriptor to this service definition. The descriptor is attached to the last `characteristic added`.
      Parameters:
        `uuid` - the UUID of the descriptor.
        `permissions` - the permissions of the descriptor (see `BluetoothPermissions`.
      Throws:
        `IllegalStateException` - if no characteristic has been added before calling this method.