Class NceClockControl
- All Implemented Interfaces:
EventListener,ClockControl,AbstractMRListener,NceListener
This module is based on the LocoNet version as worked over by David Duchamp
based on original work by Bob Jacobsen and Alex Shepherd. It implements the
sync logic to keep the Nce clock in sync with the internal clock or keeps the
internal in sync to the Nce clock. The following of the Nce clock is better
than the other way around due to the fine tuning available on the internal
clock while the Nce clock doesn't.
This file is part of JMRI.
JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.
JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Timerstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int(package private) DecimalFormat(package private) DecimalFormat(package private) Timebasestatic final int(package private) PropertyChangeListenerstatic final intstatic final intstatic final intstatic final double(package private) DecimalFormat(package private) DecimalFormatstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionNceClockControl(NceTrafficController tc, String prefix) Create a ClockControl object for a NCE clock. -
Method Summary
Modifier and TypeMethodDescriptionbooleanNce clock runs stable enoughbooleanNce clock supports 12/24 operationvoiddispose()Stop any sync, removes listeners.name of Nce clockdoublegetRate()Get last known ratio from Nce clock.getTime()Get the current Nce time, does not have a date component.voidnot sure when or if this gets called, but will issue a read to get latest timevoidvoidHandles minute notifications for NCE Clock Monitor/SynchronizervoidbooleanNCE only supports integer rates.voidsetRate(double newRate) Set Nce clock speed, must be 1 to 15.voidSet the time, the date part is ignored.voidstartHardwareClock(Date now) Set Nce clock and start clock.voidStop the Nce Clock.Methods inherited from class jmri.implementation.DefaultClockControl
getStatus, initializeHardwareClock
-
Field Details
-
CS_CLOCK_MEM_SIZE
- See Also:
-
CS_CLOCK_SCALE
- See Also:
-
CS_CLOCK_TICK
- See Also:
-
CS_CLOCK_SECONDS
- See Also:
-
CS_CLOCK_MINUTES
- See Also:
-
CS_CLOCK_HOURS
- See Also:
-
CS_CLOCK_AMPM
- See Also:
-
CS_CLOCK_1224
- See Also:
-
CS_CLOCK_STATUS
- See Also:
-
CMD_CLOCK_SET_TIME_SIZE
- See Also:
-
CMD_CLOCK_SET_PARAM_SIZE
- See Also:
-
CMD_CLOCK_SET_RUN_SIZE
- See Also:
-
CMD_CLOCK_SET_REPLY_SIZE
- See Also:
-
CMD_MEM_SET_REPLY_SIZE
- See Also:
-
MAX_ERROR_ARRAY
- See Also:
-
TARGET_SYNC_DELAY
- See Also:
-
SYNCMODE_OFF
- See Also:
-
SYNCMODE_NCE_MASTER
- See Also:
-
SYNCMODE_INTERNAL_MASTER
- See Also:
-
WAIT_CMD_EXECUTION
- See Also:
-
fiveDigits
-
fourDigits
-
threeDigits
-
twoDigits
-
internalClock
-
alarmSyncUpdate
-
minuteChangeListener
-
-
Constructor Details
-
NceClockControl
Create a ClockControl object for a NCE clock.- Parameters:
tc- traffic controller for connectionprefix- system connection prefix
-
-
Method Details
-
message
- Specified by:
messagein interfaceNceListener
-
reply
- Specified by:
replyin interfaceNceListener
-
getHardwareClockName
name of Nce clock- Specified by:
getHardwareClockNamein interfaceClockControl- Overrides:
getHardwareClockNamein classDefaultClockControl- Returns:
- the name
-
canCorrectHardwareClock
Nce clock runs stable enough- Specified by:
canCorrectHardwareClockin interfaceClockControl- Overrides:
canCorrectHardwareClockin classDefaultClockControl- Returns:
- true if correctable; false otherwise
-
canSet12Or24HourClock
Nce clock supports 12/24 operation- Specified by:
canSet12Or24HourClockin interfaceClockControl- Overrides:
canSet12Or24HourClockin classDefaultClockControl- Returns:
- true if settable; false otherwise
-
setRate
Set Nce clock speed, must be 1 to 15.- Specified by:
setRatein interfaceClockControl- Overrides:
setRatein classDefaultClockControl- Parameters:
newRate- the new rate
-
requiresIntegerRate
NCE only supports integer rates.- Specified by:
requiresIntegerRatein interfaceClockControl- Overrides:
requiresIntegerRatein classDefaultClockControl- Returns:
- true if integer rates only; false otherwise
-
getRate
Get last known ratio from Nce clock.- Specified by:
getRatein interfaceClockControl- Overrides:
getRatein classDefaultClockControl- Returns:
- Fast Clock rate.
-
setTime
Set the time, the date part is ignored.- Specified by:
setTimein interfaceClockControl- Overrides:
setTimein classDefaultClockControl- Parameters:
now- the new time
-
getTime
Get the current Nce time, does not have a date component.- Specified by:
getTimein interfaceClockControl- Overrides:
getTimein classDefaultClockControl- Returns:
- current time.
-
startHardwareClock
Set Nce clock and start clock.- Specified by:
startHardwareClockin interfaceClockControl- Overrides:
startHardwareClockin classDefaultClockControl- Parameters:
now- the starting time
-
stopHardwareClock
Stop the Nce Clock.- Specified by:
stopHardwareClockin interfaceClockControl- Overrides:
stopHardwareClockin classDefaultClockControl
-
initiateRead
not sure when or if this gets called, but will issue a read to get latest time -
dispose
Stop any sync, removes listeners. -
newInternalMinute
Handles minute notifications for NCE Clock Monitor/Synchronizer
-