
public abstract class Device extends Object implements HardwareController, HasLifecycle
| Modifier and Type | Field and Description |
|---|---|
protected BitSet |
chanMask |
protected Map<String,Control> |
ctlChans |
protected boolean |
disabled |
protected String |
fullName
Data fields.
|
protected boolean |
inited |
protected int |
lineMask |
protected int |
lineState |
protected int |
lineWarm |
protected Logger |
log |
protected Monitor |
mon |
protected String |
name |
protected boolean |
online |
protected Subsystem |
s |
| Constructor and Description |
|---|
Device() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addChannel(int id)
Adds a channel to the device's list of monitored channels.
|
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.
|
protected void |
configure(Monitor mon)
Performs common configuration.
|
void |
disable()
Disables the device.
|
protected void |
dropChannel(int id)
Drops a channel from the device's list of monitored channels.
|
void |
enable()
Enables the device.
|
String |
getFullName()
Gets the full name.
|
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.
|
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 initialization.
|
protected abstract void |
initialize()
Performs hardware initialization.
|
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 double |
readChannelNow(int hwChan,
int type)
Reads a monitor channel immediately.
|
protected void |
readSensors()
Reads all attached sensors (monitor channels).
|
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, waitcheckStarted, checkStoppedbuild, postBuild, postInit, postShutdown, postStart, shutdown, startprotected String fullName
protected final BitSet chanMask
protected boolean disabled
protected boolean inited
protected boolean online
@LookupField(strategy=TREE) protected Monitor mon
protected final Logger log
protected int lineMask
protected int lineWarm
protected int lineState
@LookupField(strategy=TOP) protected Subsystem s
@LookupName protected String name
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 getFullName()
public boolean isOnline()
public void disable()
public void enable()
protected void configure(Monitor mon)
mon - The associated monitorprotected 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 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 addChannel(int id)
id - The id of the channel.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 readSensors()
protected void readChannelGroup()
protected 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.Copyright © 2018 LSST. All rights reserved.