public abstract class Device extends Object implements 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(Channel ch) |
protected int[] |
checkChannel(String name,
int hwChan,
String type,
String subtype)
Deprecated.
Use checkChannel(Channel) instead.
|
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(Channel ch) |
protected void |
dropChannel(int id)
Deprecated.
use dropChannel(Channel instead)
|
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(Channel ch) |
protected void |
initChannel(int hwChan,
int type,
int subtype)
Deprecated.
use initiChannel(Channel) instead
|
protected void |
initChannel(String name,
int id,
int hwChan,
int type,
int subtype)
Deprecated.
use initiChannel(Channel) instead
|
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.
|
boolean |
isEnabled()
Is this Device enabled?
|
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)
Deprecated.
Use readChannel(Channel) instead;
|
protected void |
readChannelGroup()
Deprecated.
use readChannelGroup(String) instead.
|
protected void |
readChannelGroup(String group)
Reads the monitor channel group.
|
protected double |
readChannelNow(int hwChan,
int type)
Deprecated.
Use readChannelNow(Channel) instead.
|
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.
|
void |
start()
Called from the enclosing
Subsystem. |
protected boolean |
testOnline()
Tests the online state.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuild, postBuild, postInit, postShutdown, postStart, shutdownprotected 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 HasLifecyclepublic void start()
Subsystem.
At the time it is called :
PhaseState is
INITIALIZING
connection with the messaging layer is effective, the enclosing
subsystem has started StatusHeartBeat
publication
the startup configuration has been loaded (if provided). IMPORTANT
NOTE : This statement will not be true in future releases. Code that
expect the startup configuration to be loaded should be moved from
start to postStart.
super.start()
If the Device is enabled, then try to initialize the Device for the first time. Any Device implementation extending this method will have to make sure to invoke super.start().
start 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 enabled@Deprecated protected 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()
@Deprecated 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.@Deprecated 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 initChannel(Channel ch)
@Deprecated protected void dropChannel(int id)
id - The id of the channel.protected void dropChannel(Channel ch)
public void checkOnline()
protected boolean testOnline()
protected void setOnline(boolean online)
online - The online state to set: true or false@Deprecated protected void readChannelGroup()
protected void readChannelGroup(String group)
String - group nameprotected String getGroupForChannel(Channel ch)
ch - The Channel object@Deprecated 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)
@Deprecated 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 List<MonitorUpdateTask> getDeviceMonitorUpdateTasks()
public List<MonitorUpdateTask> getMonitorUpdateTasksForChannels(Channel... channels)
channels - The channels for that must be part of the returned tasks.public boolean isEnabled()
Copyright © 2022 LSST. All rights reserved.