Package jmri.jmrix.can.cbus
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringString representation of time / date from a CanMessage or CanReply.voiddispose()Stops listening for updates from network and main time base.System Connection + Clock Name, e.g.intgetTemp()Get current Temperature.voidinitializeHardwareClock(double rate, Date now, boolean getTime) Default implementation is to ignore this request.voidOutgoing CAN Frames ignored.voidListen for CAN Frames sent by external CBUS FC source.voidsetRate(double newRate) For the default implementation, setRate is ignored.voidsetTemp(int newTemp) Set current Temperature.voidFor the default implementation, set time is ignored.voidstartHardwareClock(Date now) Default implementation is to call SetTime to now.voidDefault implementation is to ignore.Methods inherited from class jmri.implementation.DefaultClockControl
canCorrectHardwareClock, canSet12Or24HourClock, getRate, getStatus, getTime, requiresIntegerRateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jmri.jmrix.can.CanListener
addTc, addTc, removeTc, removeTc
-
Constructor Details
-
CbusClockControl
-
-
Method Details
-
getTemp
Get current Temperature. Int format, not twos complement.- Returns:
- -128 to 127
-
setTemp
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:
getHardwareClockNamein interfaceClockControl- Overrides:
getHardwareClockNamein classDefaultClockControl- Returns:
- the name
-
setTime
For the default implementation, set time is ignored. Set the fast clock time.- Specified by:
setTimein interfaceClockControl- Overrides:
setTimein classDefaultClockControl- Parameters:
now- the new time
-
setRate
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:
setRatein interfaceClockControl- Overrides:
setRatein classDefaultClockControl- Parameters:
newRate- the new rate
-
initializeHardwareClock
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:
initializeHardwareClockin interfaceClockControl- Overrides:
initializeHardwareClockin classDefaultClockControl- Parameters:
rate- the ratenow- the timegetTime- true if hardware clock should be used; false otherwise
-
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:
stopHardwareClockin interfaceClockControl- Overrides:
stopHardwareClockin classDefaultClockControl
-
startHardwareClock
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:
startHardwareClockin interfaceClockControl- Overrides:
startHardwareClockin classDefaultClockControl- Parameters:
now- the starting time
-
reply
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:
replyin interfaceCanListener- Parameters:
r- the CanReply being received.
-
message
Outgoing CAN Frames ignored. Called when an outgoing message is sent to the CAN Network.- Specified by:
messagein interfaceCanListener- 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
Stops listening for updates from network and main time base.- Specified by:
disposein interfaceDisposable
-