public abstract class CurrentTimeClient extends DefaultRemoteServiceListener
CurrentTimeClient class represents a current time client.| Constructor and Description |
|---|
CurrentTimeClient(BluetoothConnection connection,
BluetoothService service)
Creates a current time client, using the current time service provided by a remote device and the connection to
this device.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
onCurrentTimeUpdate(long currentTime)
Called when the current time is received.
|
protected abstract void |
onLocalTimeUpdate(long localTimeOffset)
Called when the local time is received.
|
void |
onReadCompleted(BluetoothConnection connection,
BluetoothAttribute attribute,
byte status,
byte[] value)
Called when a response to a read request is received.
|
void |
requestTime()
Requests the current time and local time to the server.
|
void |
start()
Starts this current time client.
|
void |
stop()
Stops this current time client.
|
onNotificationReceived, onWriteCompletedpublic CurrentTimeClient(BluetoothConnection connection, BluetoothService service) throws AttributeNotFoundException
connection - the connection to the device.service - the current time service provided by the device.AttributeNotFoundException - if one of the mandatory attributes of the service is missing.protected abstract void onCurrentTimeUpdate(long currentTime)
currentTime - the current time (in milliseconds).protected abstract void onLocalTimeUpdate(long localTimeOffset)
localTimeOffset - the local time offset (in milliseconds).public void onReadCompleted(BluetoothConnection connection, BluetoothAttribute attribute, byte status, byte[] value)
RemoteServiceListeneronReadCompleted in interface RemoteServiceListeneronReadCompleted in class DefaultRemoteServiceListenerconnection - the connection with the device which has sent the response.attribute - the attribute which was read.status - the response status (see BluetoothStatus).value - the value of the attribute.BluetoothConnection.sendReadRequest(BluetoothAttribute)public void requestTime()
onCurrentTimeUpdate(long) and
onLocalTimeUpdate(long) methods are called once the time information is received from the server.public void start()
public void stop()