public class BasicServerCharacteristic extends ej.bluetooth.BluetoothCharacteristic implements NotificationCallback
BluetoothCharacteristic
that can be notified and receive read and write request.Constructor and Description |
---|
BasicServerCharacteristic(ej.bluetooth.BluetoothUuid uuid,
int properties,
int permissions)
Instantiates a
BasicServerCharacteristic . |
Modifier and Type | Method and Description |
---|---|
void |
addDescriptor(BasicServerDescriptor descriptor)
Add a descriptor.
|
BasicServerDescriptor[] |
getServerDescriptors()
Gets the server descriptor.
|
void |
onNotify(ej.bluetooth.BluetoothDevice device)
Called back when a notification for the device is requested.
|
void |
onReadRequest(ej.bluetooth.BluetoothDevice device)
Called back when a read request is received.
|
void |
onWriteRequest(ej.bluetooth.BluetoothDevice device,
byte[] value)
Called back when a write request is received.
|
addDescriptor, findDescriptor, getDescriptors, getProperties, sendNotification
public BasicServerCharacteristic(@NonNull ej.bluetooth.BluetoothUuid uuid, int properties, int permissions)
BasicServerCharacteristic
. If the characteristic can be notified or indicate, adds a CCC
descriptor.uuid
- the uuid of the characteristic.properties
- the properties of the characteristic.permissions
- the permission.public void addDescriptor(@NonNull BasicServerDescriptor descriptor)
descriptor
- the descriptor to add.public BasicServerDescriptor[] getServerDescriptors()
public void onWriteRequest(ej.bluetooth.BluetoothDevice device, byte[] value)
ReadWriteCallbackServer
onWriteRequest
in interface ReadWriteCallbackServer
device
- the device doing the write request.value
- the value to write.public void onReadRequest(ej.bluetooth.BluetoothDevice device)
ReadWriteCallbackServer
onReadRequest
in interface ReadWriteCallbackServer
device
- the device doing the read request.public void onNotify(ej.bluetooth.BluetoothDevice device)
NotificationCallback
onNotify
in interface NotificationCallback
device
- the device to notify.