Package jmri.jmrix.can.cbus
Class CbusClockControl
- java.lang.Object
-
- jmri.implementation.DefaultClockControl
-
- jmri.jmrix.can.cbus.CbusClockControl
-
- All Implemented Interfaces:
java.util.EventListener,ClockControl,Disposable,AbstractMRListener,CanListener
public class CbusClockControl extends DefaultClockControl implements CanListener, Disposable
Provide access to CBUS Clock Network Functions.- Since:
- 4.19.6
-
-
Constructor Summary
Constructors Constructor Description CbusClockControl(CanSystemConnectionMemo memo)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringdateFromCanFrame(AbstractMessage r)String representation of time / date from a CanMessage or CanReply.voiddispose()Stops listening for updates from network and main time base.java.lang.StringgetHardwareClockName()System Connection + Clock Name, e.g.intgetTemp()Get current Temperature.voidinitializeHardwareClock(double rate, java.util.Date now, boolean getTime)Default implementation is to ignore this request.voidmessage(CanMessage m)Outgoing CAN Frames ignored.voidreply(CanReply r)Listen 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.voidsetTime(java.util.Date now)For the default implementation, set time is ignored.voidstartHardwareClock(java.util.Date now)Default implementation is to call SetTime to now.voidstopHardwareClock()Default implementation is to ignore.-
Methods inherited from class jmri.implementation.DefaultClockControl
canCorrectHardwareClock, canSet12Or24HourClock, getRate, getStatus, getTime, requiresIntegerRate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.jmrix.can.CanListener
addTc, addTc, removeTc, removeTc
-
-
-
-
Constructor Detail
-
CbusClockControl
public CbusClockControl(@Nonnull CanSystemConnectionMemo memo)
-
-
Method Detail
-
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
public java.lang.String 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
public void setTime(java.util.Date now)
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
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:
setRatein interfaceClockControl- Overrides:
setRatein classDefaultClockControl- Parameters:
newRate- the new rate
-
initializeHardwareClock
public void initializeHardwareClock(double rate, java.util.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:
initializeHardwareClockin interfaceClockControl- Overrides:
initializeHardwareClockin classDefaultClockControl- Parameters:
rate- the ratenow- the timegetTime- 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:
stopHardwareClockin interfaceClockControl- Overrides:
stopHardwareClockin classDefaultClockControl
-
startHardwareClock
public void startHardwareClock(java.util.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:
startHardwareClockin interfaceClockControl- Overrides:
startHardwareClockin classDefaultClockControl- 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:
replyin interfaceCanListener- 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:
messagein interfaceCanListener- Parameters:
m- the CanMessage being sent.
-
dateFromCanFrame
public static java.lang.String dateFromCanFrame(AbstractMessage r)
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:
disposein interfaceDisposable
-
-