Class CbusClockControl

java.lang.Object
jmri.implementation.DefaultClockControl
jmri.jmrix.can.cbus.CbusClockControl
All Implemented Interfaces:
EventListener, ClockControl, Disposable, AbstractMRListener, CanListener

Provide access to CBUS Clock Network Functions.
Since:
4.19.6
  • Constructor Details

  • Method Details

    • getTemp

      public int getTemp()
      Get current Temperature. Int format, not twos complement.
      Returns:
      -128 to 127
    • setTemp

      public void setTemp(int newTemp)
      Set current Temperature. Calling this method does not send to layout, is just for setting the value. Int format, not twos complement.
      Parameters:
      newTemp - -128 to 127
    • getHardwareClockName

      System Connection + Clock Name, e.g. MERG CBUS Fast Clock. Get name of hardware clock.

      If there is no hardware clock, this method returns null. Get name of hardware clock Note: If there is no hardware clock, DefaultClockControl returns null, so all hardware clocks must override this method.

      Specified by:
      getHardwareClockName in interface ClockControl
      Overrides:
      getHardwareClockName in class DefaultClockControl
      Returns:
      the name
    • setTime

      public void setTime(Date now)
      For the default implementation, set time is ignored. Set the fast clock time.
      Specified by:
      setTime in interface ClockControl
      Overrides:
      setTime in class DefaultClockControl
      Parameters:
      now - the new time
    • setRate

      public void setRate(double newRate)
      For the default implementation, setRate is ignored. Set the rate of the Fast Clock.

      The rate is a number that multiplies the wall clock time For example, a rate of 4 specifies that the fast clock runs 4 times faster than the wall clock.

      Specified by:
      setRate in interface ClockControl
      Overrides:
      setRate in class DefaultClockControl
      Parameters:
      newRate - the new rate
    • initializeHardwareClock

      public void initializeHardwareClock(double rate, Date now, boolean getTime)
      Default implementation is to ignore this request. Initialize the hardware fast clock Note: When the hardware clock control receives this, it should initialize those clock settings that are available on the hardware clock. This method is used when the fast clock is started, and when time source, synchronize, or correct options are changed. If rate is 0.0, the hardware clock should be initialized "stopped", and the current rate saved for when the clock is restarted. If getTime is "true" the time from the hardware clock should be used in place of the supplied time if possible.
      Specified by:
      initializeHardwareClock in interface ClockControl
      Overrides:
      initializeHardwareClock in class DefaultClockControl
      Parameters:
      rate - the rate
      now - the time
      getTime - true if hardware clock should be used; false otherwise
    • stopHardwareClock

      public void stopHardwareClock()
      Default implementation is to ignore. Stop hardware fast clock. This is provided for the case where the hardware clock can be stopped and started.
      Specified by:
      stopHardwareClock in interface ClockControl
      Overrides:
      stopHardwareClock in class DefaultClockControl
    • startHardwareClock

      public void startHardwareClock(Date now)
      Default implementation is to call SetTime to now. Start hardware fast clock Some hardware fast clocks continue to run indefinitely. This is provided for the case where the hardware clock can be stopped and started.
      Specified by:
      startHardwareClock in interface ClockControl
      Overrides:
      startHardwareClock in class DefaultClockControl
      Parameters:
      now - the starting time
    • reply

      public void reply(CanReply r)
      Listen for CAN Frames sent by external CBUS FC source. Typically sent every fast minute. Called when an incoming CanFrame is received from the CAN Network.
      Specified by:
      reply in interface CanListener
      Parameters:
      r - the CanReply being received.
    • message

      public void message(CanMessage m)
      Outgoing CAN Frames ignored. Called when an outgoing message is sent to the CAN Network.
      Specified by:
      message in interface CanListener
      Parameters:
      m - the CanMessage being sent.
    • dateFromCanFrame

      String representation of time / date from a CanMessage or CanReply. Does not check for FastClock OPC.
      Parameters:
      r - FastClock Message to translate.
      Returns:
      String format of Message, e.g.
    • dispose

      public void dispose()
      Stops listening for updates from network and main time base.
      Specified by:
      dispose in interface Disposable