Package jmri.jmrix.srcp
Class SRCPClockControl
- java.lang.Object
-
- jmri.implementation.DefaultClockControl
-
- jmri.jmrix.srcp.SRCPClockControl
-
- All Implemented Interfaces:
ClockControl
public class SRCPClockControl extends DefaultClockControl
Class providing SRCP Clock Control to the SRCP client.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) SRCPBusConnectionMemo
_memo
(package private) SRCPTrafficController
_tc
-
Constructor Summary
Constructors Constructor Description SRCPClockControl(SRCPBusConnectionMemo memo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getHardwareClockName()
Get name of hardware clockdouble
getRate()
Default implementation returns the rate of the internal clock.java.util.Date
getTime()
Default implementation returns InstanceM default jmri.Timebase getTime().void
initializeHardwareClock(double rate, java.util.Date now, boolean getTime)
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.void
setRate(double newRate)
Get and set the rate of the fast clock Note: The rate is an integer that multiplies the wall clock For example, a rate of 4 specifies that the fast clock runs 4 times faster than the wall clock.void
setTime(java.util.Date now)
Set and get the fast clock time For the default implementation,set time is ignored and getTime returns the time of the internal clock;void
startHardwareClock(java.util.Date now)
Start and stop hardware fast clock Many hardware fast clocks continue to run indefinitely.void
stopHardwareClock()
Default implementation is to ignore.-
Methods inherited from class jmri.implementation.DefaultClockControl
canCorrectHardwareClock, canSet12Or24HourClock, getStatus, requiresIntegerRate
-
-
-
-
Field Detail
-
_memo
SRCPBusConnectionMemo _memo
-
-
Constructor Detail
-
SRCPClockControl
public SRCPClockControl(SRCPBusConnectionMemo memo)
-
-
Method Detail
-
getHardwareClockName
public java.lang.String getHardwareClockName()
Get name of hardware clock- Specified by:
getHardwareClockName
in interfaceClockControl
- Overrides:
getHardwareClockName
in classDefaultClockControl
- Returns:
- the name
-
setRate
public void setRate(double newRate)
Get and set the rate of the fast clock Note: The rate is an integer that multiplies the wall clock For example, a rate of 4 specifies that the fast clock runs 4 times faster than the wall clock. For the default implementation, setRate is ignored, and getRate returns the rate of the internal clock;- Specified by:
setRate
in interfaceClockControl
- Overrides:
setRate
in classDefaultClockControl
- Parameters:
newRate
- the new rate
-
getRate
public double getRate()
Description copied from class:DefaultClockControl
Default 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:
getRate
in interfaceClockControl
- Overrides:
getRate
in classDefaultClockControl
- Returns:
- Fast Clock rate.
-
setTime
public void setTime(java.util.Date now)
Set and get the fast clock time For the default implementation,set time is ignored and getTime returns the time of the internal clock;- Specified by:
setTime
in interfaceClockControl
- Overrides:
setTime
in classDefaultClockControl
- Parameters:
now
- the new time
-
getTime
public java.util.Date getTime()
Description copied from class:DefaultClockControl
Default implementation returns InstanceM default jmri.Timebase getTime(). ie. the time of the internal clock. Get the fast clock time.- Specified by:
getTime
in interfaceClockControl
- Overrides:
getTime
in classDefaultClockControl
- Returns:
- current time.
-
startHardwareClock
public void startHardwareClock(java.util.Date now)
Start and stop hardware fast clock Many 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 interfaceClockControl
- Overrides:
startHardwareClock
in classDefaultClockControl
- Parameters:
now
- the starting time
-
stopHardwareClock
public void stopHardwareClock()
Description copied from class:DefaultClockControl
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 interfaceClockControl
- Overrides:
stopHardwareClock
in classDefaultClockControl
-
initializeHardwareClock
public void initializeHardwareClock(double rate, java.util.Date now, boolean getTime)
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. Default implementation is to ignore this request.- Specified by:
initializeHardwareClock
in interfaceClockControl
- Overrides:
initializeHardwareClock
in classDefaultClockControl
- Parameters:
rate
- the ratenow
- the timegetTime
- true if hardware clock should be used; false otherwise
-
-