Class CurrentTimeClient

  • All Implemented Interfaces:
    ej.bluetooth.listeners.RemoteServiceListener

    public abstract class CurrentTimeClient
    extends ej.bluetooth.listeners.impl.DefaultRemoteServiceListener
    The CurrentTimeClient class represents a current time client.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected CurrentTimeClient​(ej.bluetooth.BluetoothConnection connection, ej.bluetooth.BluetoothService service)
      Creates a current time client, using the current time service provided by a remote device and the connection to this device.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method 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​(ej.bluetooth.BluetoothConnection connection, ej.bluetooth.BluetoothAttribute attribute, byte status, byte[] value)  
      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.
      • Methods inherited from class ej.bluetooth.listeners.impl.DefaultRemoteServiceListener

        onNotificationReceived, onWriteCompleted
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CurrentTimeClient

        protected CurrentTimeClient​(ej.bluetooth.BluetoothConnection connection,
                                    ej.bluetooth.BluetoothService service)
                             throws AttributeNotFoundException
        Creates a current time client, using the current time service provided by a remote device and the connection to this device.
        Parameters:
        connection - the connection to the device.
        service - the current time service provided by the device.
        Throws:
        AttributeNotFoundException - if one of the mandatory attributes of the service is missing.
    • Method Detail

      • start

        public void start()
        Starts this current time client.
      • stop

        public void stop()
        Stops this current time client.
      • onReadCompleted

        public void onReadCompleted​(ej.bluetooth.BluetoothConnection connection,
                                    ej.bluetooth.BluetoothAttribute attribute,
                                    byte status,
                                    byte[] value)
        Specified by:
        onReadCompleted in interface ej.bluetooth.listeners.RemoteServiceListener
        Overrides:
        onReadCompleted in class ej.bluetooth.listeners.impl.DefaultRemoteServiceListener
      • onCurrentTimeUpdate

        protected abstract void onCurrentTimeUpdate​(long currentTime)
        Called when the current time is received.
        Parameters:
        currentTime - the current time (in milliseconds).
      • onLocalTimeUpdate

        protected abstract void onLocalTimeUpdate​(long localTimeOffset)
        Called when the local time is received.
        Parameters:
        localTimeOffset - the local time offset (in milliseconds).