public class DefaultServerCallbacks extends java.lang.Object implements ServerCallbacks
DefaultServerCallbacks
class provides a default implementation of the ServerCallbacks
interface.
The implementation of the onNotificationSent()
method does nothing. The implementation of
each of the other methods sends a response with status REQUEST_NOT_SUPPORTED
.
Constructor and Description |
---|
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.
|
public void onReadRequest(BluetoothCharacteristic characteristic, BluetoothDevice device)
ServerCallbacks
onReadRequest
in interface ServerCallbacks
characteristic
- the characteristic to read.device
- the device which has sent the request.BluetoothAttribute.sendReadResponse(BluetoothDevice, int, byte[])
public void onWriteRequest(BluetoothCharacteristic characteristic, BluetoothDevice device, byte[] value)
ServerCallbacks
onWriteRequest
in interface ServerCallbacks
characteristic
- the characteristic to write.device
- the device which has sent the request.value
- the value to write.BluetoothAttribute.sendWriteResponse(BluetoothDevice, int)
public void onNotificationSent(BluetoothCharacteristic characteristic, BluetoothDevice device, boolean success)
ServerCallbacks
onNotificationSent
in interface ServerCallbacks
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.public void onReadRequest(BluetoothDescriptor descriptor, BluetoothDevice device)
ServerCallbacks
onReadRequest
in interface ServerCallbacks
descriptor
- the descriptor to read.device
- the device which has sent the request.BluetoothAttribute.sendReadResponse(BluetoothDevice, int, byte[])
public void onWriteRequest(BluetoothDescriptor descriptor, BluetoothDevice device, byte[] value)
ServerCallbacks
onWriteRequest
in interface ServerCallbacks
descriptor
- the descriptor to write.device
- the device which has sent the request.value
- the value to write.BluetoothAttribute.sendWriteResponse(BluetoothDevice, int)