public interface ServerCallbacks
ServerCallbacks
interface provides callbacks related to GATT server events.
After adding a service
to the adapter, the application may
set the server callbacks
of the service in order to be notified of the
events related to this service.
This library provides a default implementation of this interface: DefaultServerCallbacks
.
Modifier and Type | Method and Description |
---|---|
void |
onNotificationSent(BluetoothCharacteristic characteristic,
BluetoothDevice device,
boolean success)
Called when a characteristic notification is sent.
|
void |
onReadRequest(BluetoothCharacteristic characteristic,
BluetoothDevice device)
Called when a read characteristic request is received.
|
void |
onReadRequest(BluetoothDescriptor descriptor,
BluetoothDevice device)
Called when a read descriptor request is received.
|
void |
onWriteRequest(BluetoothCharacteristic characteristic,
BluetoothDevice device,
byte[] value)
Called when a write characteristic request is received.
|
void |
onWriteRequest(BluetoothDescriptor descriptor,
BluetoothDevice device,
byte[] value)
Called when a write descriptor request is received.
|
void onReadRequest(BluetoothCharacteristic characteristic, BluetoothDevice device)
characteristic
- the characteristic to read.device
- the device which has sent the request.BluetoothAttribute.sendReadResponse(BluetoothDevice, int, byte[])
void onWriteRequest(BluetoothCharacteristic characteristic, BluetoothDevice device, byte[] value)
characteristic
- the characteristic to write.device
- the device which has sent the request.value
- the value to write.BluetoothAttribute.sendWriteResponse(BluetoothDevice, int)
void onNotificationSent(BluetoothCharacteristic characteristic, BluetoothDevice device, boolean success)
characteristic
- the characteristic which has changed.device
- the device to which the notification was sent.success
- true if the notification was sent successfully, false otherwise.void onReadRequest(BluetoothDescriptor descriptor, BluetoothDevice device)
descriptor
- the descriptor to read.device
- the device which has sent the request.BluetoothAttribute.sendReadResponse(BluetoothDevice, int, byte[])
void onWriteRequest(BluetoothDescriptor descriptor, BluetoothDevice device, byte[] value)
descriptor
- the descriptor to write.device
- the device which has sent the request.value
- the value to write.BluetoothAttribute.sendWriteResponse(BluetoothDevice, int)