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 int
MAXSENSORS
Maximum number of sensors for Maple.(package private) int
timeout
(package private) boolean
warned
-
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 boolean
checkNodeAddress(int address)
Check valid node address, must match value configured in the Maple HMI.AbstractMRMessage
createInitPacket()
Create an Initialization packet (SerialMessage) for this node.AbstractMRMessage
createOutPacket()
Create a Transmit packet (SerialMessage).int
getAddress()
Get this node's address.boolean
getSensorsActive()
Get state of Sensors.int
getTimeoutCount()
boolean
handleTimeout(AbstractMRMessage m, AbstractMRListener l)
Deal with a timeout in the transmission controller.void
resetTimeout(AbstractMRMessage m)
A reply was received, so there was no timeout, do any needed processing.(package private) void
warn(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:
getSensorsActive
in 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:
checkNodeAddress
in 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:
createInitPacket
in classAbstractNode
- Returns:
- the packet, or 'null' if not needed
-
createOutPacket
public AbstractMRMessage createOutPacket()
Create a Transmit packet (SerialMessage). Not used in Maple.- Specified by:
createOutPacket
in 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:
handleTimeout
in 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:AbstractNode
A reply was received, so there was no timeout, do any needed processing.- Specified by:
resetTimeout
in classAbstractNode
- Parameters:
m
- message received that has reset the timeout and is waiting to be handled
-
getTimeoutCount
public int getTimeoutCount()
-
-