Package ej.bluetooth.listeners

## Interface LocalServiceListener

- All Known Implementing Classes:
    `DefaultLocalServiceListener`

      public interface LocalServiceListener

  The `LocalServiceListener` interface provides callbacks related to local services.

  After `adding a service` to the adapter, the application may `set the local listener` of a service in order to be notified of the events related to this service.

  This library provides a default implementation of this interface: `DefaultLocalServiceListener`.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `onExecuteWriteRequest​(BluetoothConnection connection, BluetoothAttribute attribute, boolean execute)` | Called when an execute write request is received.
    `void` | `onNotificationSent​(BluetoothConnection connection, BluetoothCharacteristic characteristic, boolean success)` | Called when a characteristic notification or indication is sent.
    `void` | `onPrepareWriteRequest​(BluetoothConnection connection, BluetoothAttribute attribute, byte[] value, int offset)` | Called when a prepare write request is received.
    `void` | `onReadBlobRequest​(BluetoothConnection connection, BluetoothAttribute attribute, int offset)` | Called when a read blob request is received.
    `void` | `onReadRequest​(BluetoothConnection connection, BluetoothAttribute attribute)` | Called when a read request is received.
    `void` | `onWriteRequest​(BluetoothConnection connection, BluetoothAttribute attribute, byte[] value)` | Called when a write request is received.

- - ### Method Detail

    - #### onReadRequest

          void onReadRequest​(BluetoothConnection connection,
                             BluetoothAttribute attribute)

      Called when a read request is received.
      Parameters:
        `connection` - the connection with the device which has sent the request.
        `attribute` - the attribute to read.

    - #### onReadBlobRequest

          void onReadBlobRequest​(BluetoothConnection connection,
                                 BluetoothAttribute attribute,
                                 int offset)

      Called when a read blob request is received.
      Parameters:
        `connection` - the connection with the device which has sent the request.
        `attribute` - the attribute to read.
        `offset` - the offset of the first octet to read.

    - #### onWriteRequest

          void onWriteRequest​(BluetoothConnection connection,
                              BluetoothAttribute attribute,
                              byte[] value)

      Called when a write request is received.
      Parameters:
        `connection` - the connection with the device which has sent the request.
        `attribute` - the attribute to write.
        `value` - the value to write.

    - #### onPrepareWriteRequest

          void onPrepareWriteRequest​(BluetoothConnection connection,
                                     BluetoothAttribute attribute,
                                     byte[] value,
                                     int offset)

      Called when a prepare write request is received. The write operation is queued until an execute write request is received.
      Parameters:
        `connection` - the connection with the device which has sent the request.
        `attribute` - the attribute to write.
        `value` - the value to write.
        `offset` - the offset of the first octet to write.

    - #### onExecuteWriteRequest

          void onExecuteWriteRequest​(BluetoothConnection connection,
                                     BluetoothAttribute attribute,
                                     boolean execute)

      Called when an execute write request is received. All pending prepared write operations are executed or cancelled.
      Parameters:
        `connection` - the connection with the device which has sent the request.
        `attribute` - the attribute to write.
        `execute` - true if the pending prepared writes should be executed, false if they should be cancelled.

    - #### onNotificationSent

          void onNotificationSent​(BluetoothConnection connection,
                                  BluetoothCharacteristic characteristic,
                                  boolean success)

      Called when a characteristic notification or indication is sent.

      If a notification was sent, this method is called as soon as the notification is sent to the device. If an indication was sent, this method is called when the device acknowledges the indication.

      Parameters:
        `connection` - the connection with the device to which the notification was sent.
        `characteristic` - the characteristic which has changed.
        `success` - true if the notification was sent successfully, false otherwise.
      See Also:
        `BluetoothConnection.sendNotification(BluetoothCharacteristic, byte[], boolean)`