jmri
Interface ClockControl

All Known Implementing Classes:
DefaultClockControl, LnClockControl, NceClockControl

public interface ClockControl

ClockControl defines an interface for control of hardware Fast Clocks

Each hardware system that has a hardware Fast Clock implementation must supply a module that implements this interface. Each ClockControl module must register itself with the Instance Manager at start up.

Parameters for fast clocks are set up generically in the Fast Clock Setup, accessed via the JMRI Tools menu. These parameters are saved in the configuration file generically, so no special configxml module is needed for storing parameters.

Hardware ClockControl modules should extend DefaultClockControl, which supplies default implementations of methods required by this interface that specific hardware implementations may not need.

All Clock Control modules communicate with the internal clock and the master JMRI Timebase, using methods of the Timebase interface.


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.

Author:
Dave Duchamp Copyright (C) 2007

Method Summary
 boolean canCorrectHardwareClock()
          Returns true if hardware clock accuracy can be corrected using the computer clock.
 boolean canSet12Or24HourClock()
          Returns 'true' if hardware clock can be set to 12 or 24 hour display from JMRI software.
 String getHardwareClockName()
          Get name of hardware clock Note: If there is no hardware clock, DefaultClockControl returns null, so all hardware clocks must override this method.
 double getRate()
           
 int getStatus()
          Get status of the fast clock
 Date getTime()
           
 void initializeHardwareClock(double rate, 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.
 boolean requiresIntegerRate()
          Returns true if hardware clock requires an integer rate
 void setRate(double newRate)
          Get and set the rate of the fast clock Note: 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.
 void setTime(Date now)
          Set and get the fast clock time
 void startHardwareClock(Date now)
          Start and stop hardware fast clock Some hardware fast clocks continue to run indefinitely.
 void stopHardwareClock()
           
 

Method Detail

getStatus

int getStatus()
Get status of the fast clock


getHardwareClockName

String getHardwareClockName()
Get name of hardware clock Note: If there is no hardware clock, DefaultClockControl returns null, so all hardware clocks must override this method.


canCorrectHardwareClock

boolean canCorrectHardwareClock()
Returns true if hardware clock accuracy can be corrected using the computer clock.


canSet12Or24HourClock

boolean canSet12Or24HourClock()
Returns 'true' if hardware clock can be set to 12 or 24 hour display from JMRI software.


requiresIntegerRate

boolean requiresIntegerRate()
Returns true if hardware clock requires an integer rate


setRate

void setRate(double newRate)
Get and set the rate of the fast clock Note: 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.


getRate

double getRate()

setTime

void setTime(Date now)
Set and get the fast clock time


getTime

Date getTime()

startHardwareClock

void startHardwareClock(Date now)
Start and stop 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.


stopHardwareClock

void stopHardwareClock()

initializeHardwareClock

void initializeHardwareClock(double rate,
                             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. 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.



Copyright © 1997 - 2008 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: SourceForge_Logo