Package jmri.jmrix.dccpp
Class DCCppClockControl
java.lang.Object
jmri.implementation.DefaultClockControl
jmri.jmrix.dccpp.DCCppClockControl
- All Implemented Interfaces:
EventListener,ClockControl,AbstractMRListener,DCCppListener
Class providing Clock Control to the DCC-EX client.
Does nothing unless "Synchronize Internal Fast Clock and DCC-EX Fast Clock" is enabled.
If "Time Source" is "Internal Computer Clock", send any changes to Fast Clock Rate or Time
to the command station.
If "Time Source" is "DCC-EX Fast Clock", listen for incoming Time messages and set the Fast
Clock from these. Ignores incoming Rate messages.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Calendar(package private) DCCppSystemConnectionMemo(package private) DCCppTrafficController(package private) boolean(package private) PropertyChangeListener(package private) static final long(package private) static final long(package private) Timebase -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet name of hardware clock, shown in UIdoublegetRate()Default implementation returns the rate of the internal clock.getTime()Default implementation returns InstanceM default jmri.Timebase getTime().voidinitializeHardwareClock(double rate, Date now, boolean getTime) Default implementation is to ignore this request.voidmessage(DCCppMessage msg) Member function that will be invoked by a DCCppInterface implementation to forward a DCC++ message sent to the layout.voidmessage(DCCppReply msg) Member function that will be invoked by a DCCppInterface implementation to forward a DCC++ message from the layout.voidMember function invoked by an DCCppInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.booleanPrevent user entry of a fractional rate, since DCC-EX only supports integer ratesvoidsetRate()voidsetRate(double newRate) Send the new fastclock rate to CS if internal is master AND synchronize enabled send rate of zero if clock is not running Note: fastclock rate and time are in a single messagevoidsetTime()voidSend the new fast clock time to CS if internal is master AND synchronize enabled Note: fastclock rate and time are in a single messagevoidstartHardwareClock(Date now) Pause, unpause and initialize fast clockvoidDefault implementation is to ignore.Methods inherited from class jmri.implementation.DefaultClockControl
canCorrectHardwareClock, canSet12Or24HourClock, getStatus
-
Field Details
-
_memo
-
_tc
-
timebase
-
_cal
-
minuteChangeListener
-
isRunning
boolean isRunning -
MSECPERHOUR
- See Also:
-
MSECPERMINUTE
- See Also:
-
-
Constructor Details
-
DCCppClockControl
-
-
Method Details
-
getHardwareClockName
Get name of hardware clock, shown in UI- Specified by:
getHardwareClockNamein interfaceClockControl- Overrides:
getHardwareClockNamein classDefaultClockControl- Returns:
- the name
-
setRate
Send the new fastclock rate to CS if internal is master AND synchronize enabled send rate of zero if clock is not running Note: fastclock rate and time are in a single message- Specified by:
setRatein interfaceClockControl- Overrides:
setRatein classDefaultClockControl- Parameters:
newRate- the new rate
-
setRate
-
getRate
Description copied from class:DefaultClockControlDefault implementation returns the rate of the internal clock. Get the rate of the Fast Clock.The rate is a number that multiplies the wall clock. For example, a rate of 4 specifies that the fast clock runs 4 times faster than the wall clock.
- Specified by:
getRatein interfaceClockControl- Overrides:
getRatein classDefaultClockControl- Returns:
- Fast Clock rate.
-
setTime
Send the new fast clock time to CS if internal is master AND synchronize enabled Note: fastclock rate and time are in a single message- Specified by:
setTimein interfaceClockControl- Overrides:
setTimein classDefaultClockControl- Parameters:
newTimestamp- the new time
-
setTime
-
getTime
Description copied from class:DefaultClockControlDefault implementation returns InstanceM default jmri.Timebase getTime(). ie. the time of the internal clock. Get the fast clock time.- Specified by:
getTimein interfaceClockControl- Overrides:
getTimein classDefaultClockControl- Returns:
- current time.
-
startHardwareClock
Pause, unpause and initialize fast clock- Specified by:
startHardwareClockin interfaceClockControl- Overrides:
startHardwareClockin classDefaultClockControl- Parameters:
now- the starting time
-
stopHardwareClock
Description copied from class:DefaultClockControlDefault 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
-
initializeHardwareClock
Description copied from class:DefaultClockControlDefault 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
-
requiresIntegerRate
Prevent user entry of a fractional rate, since DCC-EX only supports integer rates- Specified by:
requiresIntegerRatein interfaceClockControl- Overrides:
requiresIntegerRatein classDefaultClockControl- Returns:
- true if integer rates only; false otherwise
-
message
Description copied from interface:DCCppListenerMember function that will be invoked by a DCCppInterface implementation to forward a DCC++ message from the layout.- Specified by:
messagein interfaceDCCppListener- Parameters:
msg- The received DCC++ message. Note that this same object may be presented to multiple users. It should not be modified here.
-
message
Description copied from interface:DCCppListenerMember function that will be invoked by a DCCppInterface implementation to forward a DCC++ message sent to the layout. Normally, this function will do nothing.- Specified by:
messagein interfaceDCCppListener- Parameters:
msg- The received DCC++ message. Note that this same object may be presented to multiple users. It should not be modified here.
-
notifyTimeout
Description copied from interface:DCCppListenerMember function invoked by an DCCppInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.- Specified by:
notifyTimeoutin interfaceDCCppListener- Parameters:
msg- the message that timed out.
-