Package ej.bluetooth.listeners.impl
Class DefaultLocalServiceListener
- java.lang.Object
-
- ej.bluetooth.listeners.impl.DefaultLocalServiceListener
-
- All Implemented Interfaces:
LocalServiceListener
public class DefaultLocalServiceListener extends Object implements LocalServiceListener
TheDefaultLocalServiceListenerclass provides a default implementation of theLocalServiceListenerinterface.The implementation of the
onNotificationSent()method does nothing. The implementation of each of the other methods sends a response with statusREQUEST_NOT_SUPPORTED.
-
-
Constructor Summary
Constructors Constructor Description DefaultLocalServiceListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonExecuteWriteRequest(BluetoothConnection connection, BluetoothAttribute attribute, boolean execute)Called when an execute write request is received.voidonNotificationSent(BluetoothConnection connection, BluetoothCharacteristic characteristic, boolean success)Called when a characteristic notification or indication is sent.voidonPrepareWriteRequest(BluetoothConnection connection, BluetoothAttribute attribute, byte[] value, int offset)Called when a prepare write request is received.voidonReadBlobRequest(BluetoothConnection connection, BluetoothAttribute attribute, int offset)Called when a read blob request is received.voidonReadRequest(BluetoothConnection connection, BluetoothAttribute attribute)Called when a read request is received.voidonWriteRequest(BluetoothConnection connection, BluetoothAttribute attribute, byte[] value)Called when a write request is received.
-
-
-
Method Detail
-
onReadRequest
public void onReadRequest(BluetoothConnection connection, BluetoothAttribute attribute)
Description copied from interface:LocalServiceListenerCalled when a read request is received.- Specified by:
onReadRequestin interfaceLocalServiceListener- Parameters:
connection- the connection with the device which has sent the request.attribute- the attribute to read.
-
onReadBlobRequest
public void onReadBlobRequest(BluetoothConnection connection, BluetoothAttribute attribute, int offset)
Description copied from interface:LocalServiceListenerCalled when a read blob request is received.- Specified by:
onReadBlobRequestin interfaceLocalServiceListener- 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
public void onWriteRequest(BluetoothConnection connection, BluetoothAttribute attribute, byte[] value)
Description copied from interface:LocalServiceListenerCalled when a write request is received.- Specified by:
onWriteRequestin interfaceLocalServiceListener- Parameters:
connection- the connection with the device which has sent the request.attribute- the attribute to write.value- the value to write.
-
onPrepareWriteRequest
public void onPrepareWriteRequest(BluetoothConnection connection, BluetoothAttribute attribute, byte[] value, int offset)
Description copied from interface:LocalServiceListenerCalled when a prepare write request is received. The write operation is queued until an execute write request is received.- Specified by:
onPrepareWriteRequestin interfaceLocalServiceListener- 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
public void onExecuteWriteRequest(BluetoothConnection connection, BluetoothAttribute attribute, boolean execute)
Description copied from interface:LocalServiceListenerCalled when an execute write request is received. All pending prepared write operations are executed or cancelled.- Specified by:
onExecuteWriteRequestin interfaceLocalServiceListener- 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
public void onNotificationSent(BluetoothConnection connection, BluetoothCharacteristic characteristic, boolean success)
Description copied from interface:LocalServiceListenerCalled 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.
- Specified by:
onNotificationSentin interfaceLocalServiceListener- 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)
-
-