Package jmri.jmrix.maple
Class SerialNode
- java.lang.Object
-
- jmri.jmrix.AbstractNode
-
- jmri.jmrix.maple.SerialNode
-
public class SerialNode extends AbstractNode
Models a serial node, consisting of one Maple Systems HMI touch screen panel.Nodes are numbered ala the Station number, from 1 to 99.
The array of sensor states is used to update sensor known state only when there's a change on the serial bus. This allows for the sensor state to be updated within the program, keeping this updated state until the next change on the serial bus. E.g. you can manually change a state via an icon, and not have it change back the next time that node is polled.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static intMAXSENSORSMaximum number of sensors for Maple.(package private) inttimeout(package private) booleanwarned-
Fields inherited from class jmri.jmrix.AbstractNode
nodeAddress
-
-
Constructor Summary
Constructors Constructor Description SerialNode(int address, int type, SerialTrafficController tc)Create a new SerialNode and initialize default instance variables.SerialNode(SerialTrafficController tc)Assumes a node address of 1, and a node type of 0.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckNodeAddress(int address)Check valid node address, must match value configured in the Maple HMI.AbstractMRMessagecreateInitPacket()Create an Initialization packet (SerialMessage) for this node.AbstractMRMessagecreateOutPacket()Create a Transmit packet (SerialMessage).intgetAddress()Get this node's address.booleangetSensorsActive()Get state of Sensors.intgetTimeoutCount()booleanhandleTimeout(AbstractMRMessage m, AbstractMRListener l)Deal with a timeout in the transmission controller.voidresetTimeout(AbstractMRMessage m)A reply was received, so there was no timeout, do any needed processing.(package private) voidwarn(java.lang.String s)-
Methods inherited from class jmri.jmrix.AbstractNode
getNodeAddress, mustSend, resetMustSend, setMustSend, setNodeAddress
-
-
-
-
Field Detail
-
MAXSENSORS
static final int MAXSENSORS
Maximum number of sensors for Maple.- See Also:
- Constant Field Values
-
warned
boolean warned
-
timeout
int timeout
-
-
Constructor Detail
-
SerialNode
public SerialNode(SerialTrafficController tc)
Assumes a node address of 1, and a node type of 0. If this constructor is used, actual node address must be set using setNodeAddress.- Parameters:
tc- serial traffic controller.
-
SerialNode
public SerialNode(int address, int type, SerialTrafficController tc)
Create a new SerialNode and initialize default instance variables.- Parameters:
address- Address of node on serial bus (0-99)type- 0 (ignored)tc- system traffic controller.
-
-
Method Detail
-
getSensorsActive
public boolean getSensorsActive()
Get state of Sensors.- Specified by:
getSensorsActivein classAbstractNode- Returns:
- 'true' since at least one sensor is defined
-
checkNodeAddress
protected boolean checkNodeAddress(int address)
Check valid node address, must match value configured in the Maple HMI.- Specified by:
checkNodeAddressin classAbstractNode- Parameters:
address- node ID, allowed values are 1-99- Returns:
- true if in valid range
-
getAddress
public int getAddress()
Get this node's address.- Returns:
- node address.
-
createInitPacket
public AbstractMRMessage createInitPacket()
Create an Initialization packet (SerialMessage) for this node.Note: Maple Systems devices do not need initialization. This is here for completion.
- Specified by:
createInitPacketin classAbstractNode- Returns:
- the packet, or 'null' if not needed
-
createOutPacket
public AbstractMRMessage createOutPacket()
Create a Transmit packet (SerialMessage). Not used in Maple.- Specified by:
createOutPacketin classAbstractNode- Returns:
- packet to send current node state.
-
warn
void warn(java.lang.String s)
-
handleTimeout
public boolean handleTimeout(AbstractMRMessage m, AbstractMRListener l)
Deal with a timeout in the transmission controller.- Specified by:
handleTimeoutin classAbstractNode- Parameters:
m- message that didn't receive a replyl- listener that sent the message- Returns:
- true if initialization required
-
resetTimeout
public void resetTimeout(AbstractMRMessage m)
Description copied from class:AbstractNodeA reply was received, so there was no timeout, do any needed processing.- Specified by:
resetTimeoutin classAbstractNode- Parameters:
m- message received that has reset the timeout and is waiting to be handled
-
getTimeoutCount
public int getTimeoutCount()
-
-