Package uk.ac.gda.server.ncd.timing
Class TimerWrapper
java.lang.Object
uk.ac.gda.server.ncd.timing.TimerWrapper
- All Implemented Interfaces:
Device,Timer,Configurable,Findable,gda.observable.IObservable
- Direct Known Subclasses:
LoadFramesTimerHook
Delegating wrapper to allow additional functionality to be added to an existing Timer
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFrameSet(int frameCount, double requestedDeadTime, double requestedLiveTime) Create a single frameSet object for a specified live and dead time.voidaddFrameSet(int frameCount, double requestedDeadTime, double requestedLiveTime, int deadPort, int livePort, int deadPause, int livePause) Create a single frameSet object for a specified live and dead time.voidaddIObserver(gda.observable.IObserver observer) voidClear all current frameSetsvoidclose()Close and unconfigure the device.voidPerform operations that must be done after Spring initialisation i.e.voidcountAsync(double time) Initiates a single specified timing period and allows the timer to proceed asynchronously.voiddeleteIObserver(gda.observable.IObserver observer) voidgetAttribute(String attributeName) Get the value of the specified attributeintReturns the current cycle number.intReturns the current frame number.intReturns the total number of frame pairs supported (each specifying a live and a dead period)getName()Get the object name.intintReturns the current state of the timer All timers must fully implement this.booleanIndicates whether this object should be configured at startup.booleanChecks to see if the object is already configured.voidLoad an array of frameSets obtained from calls to makeFrameSet() are loaded into the timer.voidOutput data from timer directly to filevoidRe-initialisation of values and states.voidrestart()Restarts framing from the paused statevoidsetAttribute(String attributeName, Object value) Set any attribute the implementing classes may providevoidsetCycles(int cycles) sets the number of times the timer cycles through the framesets.voidSet or change the name of the object (as defined in XML).voidsetProtectionLevel(int newLevel) Sets the permission level for this object.voidstart()For a time framing counter-timer, this initiates framing, starting from the current frame number (specified by setFrameNumber())voidstop()Aborts any current timing and returns it to an idle state.
-
Constructor Details
-
TimerWrapper
-
-
Method Details
-
setName
Description copied from interface:FindableSet or change the name of the object (as defined in XML). -
configure
Description copied from interface:ConfigurablePerform operations that must be done after Spring initialisation i.e. anything that goes beyond setting member variables.- Specified by:
configurein interfaceConfigurable- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
getName
Description copied from interface:FindableGet the object name. Used by Castor to check if the object name has been set before calling theFindable.setName(String)method. -
addIObserver
public void addIObserver(gda.observable.IObserver observer) - Specified by:
addIObserverin interfacegda.observable.IObservable
-
setAttribute
Description copied from interface:DeviceSet any attribute the implementing classes may provide- Specified by:
setAttributein interfaceDevice- Parameters:
attributeName- is the name of the attributevalue- is the value of the attribute- Throws:
DeviceException- if an attribute cannot be set
-
getStatus
Description copied from interface:TimerReturns the current state of the timer All timers must fully implement this.- Specified by:
getStatusin interfaceTimer- Returns:
- ACTIVE if the timer has not finished the requested operation(s), IDLE if in an completely idle state and PAUSED if temporarily suspended.
- Throws:
DeviceException
-
deleteIObserver
public void deleteIObserver(gda.observable.IObserver observer) - Specified by:
deleteIObserverin interfacegda.observable.IObservable
-
isConfigured
public boolean isConfigured()Description copied from interface:ConfigurableChecks to see if the object is already configured.- Specified by:
isConfiguredin interfaceConfigurable- Returns:
- return
trueif configuredfalseotherwise
-
deleteIObservers
public void deleteIObservers()- Specified by:
deleteIObserversin interfacegda.observable.IObservable
-
reconfigure
Description copied from interface:ConfigurableRe-initialisation of values and states.Moved from Reconfigurable which has been deleted
- Specified by:
reconfigurein interfaceConfigurable- Throws:
FactoryException
-
getAttribute
Description copied from interface:DeviceGet the value of the specified attribute- Specified by:
getAttributein interfaceDevice- Parameters:
attributeName- is the name of the attribute- Returns:
- the value of the attribute as an Object type
- Throws:
DeviceException- if an attribute cannot be retrieved
-
getMaximumFrames
Description copied from interface:TimerReturns the total number of frame pairs supported (each specifying a live and a dead period)- Specified by:
getMaximumFramesin interfaceTimer- Returns:
- maximum number of time frames available
- Throws:
DeviceException
-
isConfigureAtStartup
public boolean isConfigureAtStartup()Description copied from interface:ConfigurableIndicates whether this object should be configured at startup.Moved from ConditionallyConfigurable which has been deleted
- Specified by:
isConfigureAtStartupin interfaceConfigurable
-
getCurrentFrame
Description copied from interface:TimerReturns the current frame number.- Specified by:
getCurrentFramein interfaceTimer- Returns:
- the current frame counter number (1st=0)
- Throws:
DeviceException
-
close
Description copied from interface:DeviceClose and unconfigure the device.- Specified by:
closein interfaceDevice- Throws:
DeviceException
-
getCurrentCycle
Description copied from interface:TimerReturns the current cycle number. If not implemented this should return a default of 1.- Specified by:
getCurrentCyclein interfaceTimer- Returns:
- the current cycle number
- Throws:
DeviceException
-
setProtectionLevel
public void setProtectionLevel(int newLevel) Description copied from interface:DeviceSets the permission level for this object. If this is not set then a default value will be applied.- Specified by:
setProtectionLevelin interfaceDevice- Parameters:
newLevel-
-
setCycles
Description copied from interface:Timersets the number of times the timer cycles through the framesets. Default is 1 if h/w does not allow the implementation- Specified by:
setCyclesin interfaceTimer- Parameters:
cycles- sets the cycle count to the specified number- Throws:
DeviceException
-
getProtectionLevel
public int getProtectionLevel()- Specified by:
getProtectionLevelin interfaceDevice- Returns:
- int - the permission level for this object.
-
start
Description copied from interface:TimerFor a time framing counter-timer, this initiates framing, starting from the current frame number (specified by setFrameNumber())- Specified by:
startin interfaceTimer- Throws:
DeviceException
-
stop
Description copied from interface:TimerAborts any current timing and returns it to an idle state.- Specified by:
stopin interfaceTimer- Throws:
DeviceException
-
restart
Description copied from interface:TimerRestarts framing from the paused state- Specified by:
restartin interfaceTimer- Throws:
DeviceException
-
addFrameSet
public void addFrameSet(int frameCount, double requestedDeadTime, double requestedLiveTime) throws DeviceException Description copied from interface:TimerCreate a single frameSet object for a specified live and dead time. A count for identical frames is specified by the frameCount.- Specified by:
addFrameSetin interfaceTimer- Parameters:
frameCount- the requested number of frames required of this typerequestedDeadTime- the requested frame dead time in millisecondsrequestedLiveTime- the requested frame live time in milliseconds- Throws:
DeviceException
-
addFrameSet
public void addFrameSet(int frameCount, double requestedDeadTime, double requestedLiveTime, int deadPort, int livePort, int deadPause, int livePause) throws DeviceException Description copied from interface:TimerCreate a single frameSet object for a specified live and dead time. A count for identical frames is specified by the frameCount.- Specified by:
addFrameSetin interfaceTimer- Parameters:
frameCount- the requested number of frames required of this typerequestedDeadTime- the requested frame dead time in millisecondsrequestedLiveTime- the requested frame live time in millisecondsdeadPort- the wait period output level 0 or 1livePort- the run period output level 0 or 1deadPause- the pause before wait period 0 or 1livePause- the pause before run period 0 or 1- Throws:
DeviceException
-
clearFrameSets
Description copied from interface:TimerClear all current frameSets- Specified by:
clearFrameSetsin interfaceTimer- Throws:
DeviceException
-
loadFrameSets
Description copied from interface:TimerLoad an array of frameSets obtained from calls to makeFrameSet() are loaded into the timer.- Specified by:
loadFrameSetsin interfaceTimer- Throws:
DeviceException
-
countAsync
Description copied from interface:TimerInitiates a single specified timing period and allows the timer to proceed asynchronously. The end of period can be determined by calls to getStatus() returning IDLE.- Specified by:
countAsyncin interfaceTimer- Parameters:
time- the requested counting time in milliseconds- Throws:
DeviceException
-
output
Description copied from interface:TimerOutput data from timer directly to file- Specified by:
outputin interfaceTimer- Parameters:
file- is the fully qualified file name- Throws:
DeviceException
-