
public abstract class Device extends Object implements HardwareController, HasLifecycle
| Modifier and Type | Field and Description |
|---|---|
protected String |
alertOfflineId |
protected AlertService |
alertService |
protected ConfigurationService |
configService |
protected String |
fullName |
protected boolean |
inited
boolean inited: not used in parent Device code, but suggested
to be set true in extensions of Device after a first initialize()
is complete, successful or not.
|
protected int |
lineMask |
protected int |
lineState |
protected int |
lineWarm |
protected Logger |
log |
protected Monitor |
mon |
protected String |
name |
protected String |
path |
protected Subsystem |
s |
| Constructor and Description |
|---|
Device() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addLine(int line)
Adds an output line to the known list.
|
protected int[] |
checkChannel(String name,
int hwChan,
String type,
String subtype)
Checks a monitor channel's parameters for validity.
|
TreeWalkerDiag |
checkHardware()
Override to initiate interaction with the hardware.
|
protected void |
checkHwLine(String name,
int line)
Checks the validity of an output line.
|
protected void |
checkLine(String name,
int line)
Checks the validity of an output line.
|
void |
checkOnline()
Checks the online state.
|
protected void |
checkTimeout(Exception e,
Class<?> eClass)
Deprecated.
|
protected abstract void |
close()
Closes the connection (typically by invoking a driver close())
|
protected void |
configure(Monitor mon)
Deprecated.
|
void |
disable()
Deprecated.
|
protected void |
dropChannel(int id)
Drops a channel from the device's list of monitored channels.
|
void |
enable()
Deprecated.
|
List<MonitorUpdateTask> |
getDeviceMonitorUpdateTasks()
Get the list of MonitorUpdateTasks for this Device.
|
String |
getFullName()
Gets the full name.
|
protected String |
getGroupForChannel(Channel ch)
Get the group a given channel belongs to.
|
List<MonitorUpdateTask> |
getMonitorUpdateTasksForChannels(Channel... channels)
Get the list of MonitorUpdateTasks for the provided
Channels belonging to this device.
|
String |
getName()
Get the name of this device as defined in the groovy file.
|
protected void |
getOutputLines()
Gets the states of all output lines and saves them.
|
String |
getPath()
Get the path of this device.
|
void |
init()
Called from the enclosing
Subsystem at initialization
phase. |
protected void |
initChannel(int hwChan,
int type,
int subtype)
Initializes a monitor channel.
|
protected void |
initChannel(String name,
int id,
int hwChan,
int type,
int subtype)
Initializes a monitor channel.
|
protected void |
initDevice()
Performs internal device-code initialization.
|
protected abstract void |
initialize()
Performs hardware initialization
Guidance: If all hardware interactions (connection and
initialization, via driver) succeed, then setOnline(true).
|
protected void |
initSensors()
Initializes all attached sensors.
|
protected Boolean |
isHwLineSet(int line)
Gets an output line set state.
|
protected Boolean |
isLineSet(int line)
Gets an output line set state.
|
boolean |
isOnline()
Gets the online state.
|
protected boolean |
isTimeout(Exception e)
Deprecated.
|
protected double |
readChannel(Channel ch) |
protected double |
readChannel(int hwChan,
int type)
Reads a monitor channel.
|
protected void |
readChannelGroup()
Reads the monitor channel group.
|
protected void |
readChannelGroup(String group)
Reads the monitor channel group.
|
protected double |
readChannelNow(int hwChan,
int type)
Reads a monitor channel immediately.
|
void |
setDisabled(Boolean value)
Set device-disabled state
|
protected void |
setHwLine(int line,
boolean on)
Sets an output line on or off.
|
protected void |
setLine(int line,
boolean on)
Sets an output line on or off.
|
protected void |
setLineWarm(int line,
boolean on)
Sets the warm-start state of an output line.
|
protected void |
setOnline(boolean online)
Sets the online state.
|
protected void |
setOutputLines()
Sets all output lines from the saved state.
|
protected boolean |
testOnline()
Tests the online state.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcheckStoppedbuild, postBuild, postInit, postShutdown, postStart, shutdown, startprotected boolean inited
protected final Logger log
protected int lineMask
protected int lineWarm
protected int lineState
@LookupField(strategy=TREE) protected Monitor mon
@LookupField(strategy=TOP) protected Subsystem s
@LookupField(strategy=TREE) protected ConfigurationService configService
@LookupField(strategy=TREE) protected AlertService alertService
@LookupName protected String name
@LookupPath protected String path
@LookupPath protected String fullName
protected String alertOfflineId
public void init()
HasLifecycleSubsystem at initialization
phase.
This method is called before the children components of this
object have their init method called.
At the time it is called, connection to the messaging layer is not yet
done, so there should be no attempt to send messages in the body of
this method. Configuration for message listening can nevertheless be
done here, such as adding MessageListener
objects.
It is unnecessary to call super.init()
init in interface HasLifecycleprotected void initDevice()
public String getName()
public String getPath()
public String getFullName()
public boolean isOnline()
@Deprecated public void disable()
@Deprecated public void enable()
@Deprecated protected void configure(Monitor mon)
mon - The associated monitor@ConfigurationParameterChanger(propertyName="disabled") public void setDisabled(Boolean value)
Boolean - value True for device disabled, false for enabledprotected int[] checkChannel(String name, int hwChan, String type, String subtype) throws Exception
name - The name of the channel.hwChan - The hardware channel number.type - The channel type string.subtype - The channel subtype string.Exception - if any errors found in the parametersprotected abstract void initialize()
protected abstract void close()
protected final void initSensors()
protected void initChannel(int hwChan,
int type,
int subtype)
hwChan - The hardware channel number.type - The encoded channel type returned by checkChannel.subtype - The channel subtype returned by checkChannel.protected void initChannel(String name, int id, int hwChan, int type, int subtype)
name - The channel nameid - The channel IDhwChan - The hardware channel number.type - The encoded channel type returned by checkChannel.subtype - The channel subtype returned by checkChannel.protected void dropChannel(int id)
id - The id of the channel.public void checkOnline()
protected boolean testOnline()
protected void setOnline(boolean online)
online - The online state to set: true or falseprotected void readChannelGroup()
protected void readChannelGroup(String group)
String - group nameprotected String getGroupForChannel(Channel ch)
ch - The Channel objectprotected double readChannel(int hwChan,
int type)
hwChan - The hardware channel number.type - The encoded channel type returned by checkChannel.protected double readChannel(Channel ch)
protected double readChannelNow(int hwChan,
int type)
hwChan - The hardware channel number.type - The encoded channel type returned by checkChannel.@Deprecated protected void checkTimeout(Exception e, Class<?> eClass) throws Exception
e - The exception to be checked.eClass - The class of the exception to be thrown.Exception@Deprecated protected boolean isTimeout(Exception e)
e - The exception to be tested.protected final void checkLine(String name, int line) throws Exception
name - The name of the output line.line - The hardware line number of the output line.Exception - if the line number is invalid.protected void checkHwLine(String name, int line) throws Exception
name - The name of the output line.line - The hardware line number of the output line.Exception - if the line number is invalid.protected void setLineWarm(int line,
boolean on)
line - The output line number.on - The warm-start on state to set: true or falseprotected final void setLine(int line,
boolean on)
line - The output line number.on - The on state to set: true or falseprotected void setHwLine(int line,
boolean on)
line - The output line number.on - The on state to set: true or falseprotected final Boolean isLineSet(int line)
line - The output line number.protected Boolean isHwLineSet(int line)
line - The output line number.protected void setOutputLines()
protected void getOutputLines()
protected void addLine(int line)
line - The output line number.public TreeWalkerDiag checkHardware() throws HardwareException
HardwareControllerPhaseState.INITIALIZING state.
If accessing the hardware is considered as having failed, this method
should throw an HardwareException. This will
interrupt the startup process and make the subsystem go to
OperationalState.ENGINEERING_FAULT and stays in PhaseState.INITIALIZING.
The startup process will be resumed with a call to
org.lsst.ccs.Subsystem#completeInitialization() that will invoke
HardwareController#checkStarted()
If this method is considered having succeeded, the state goes to
OperationalState.ENGINEERING_OK and PhaseState.OPERATIONAL
checkHardware in interface HardwareControllerTreeWalkerDiag indicating if
this component has already performed hardware checking for its own
components (HANDLING_CHILDREN) or if the framework should do it
(GO)HardwareException - if any failure interacting with the hardware
occurs. The exception is caught by the framework.public List<MonitorUpdateTask> getDeviceMonitorUpdateTasks()
public List<MonitorUpdateTask> getMonitorUpdateTasksForChannels(Channel... channels)
channels - The channels for that must be part of the returned tasks.Copyright © 2021 LSST. All rights reserved.