|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.jmrix.AbstractNode
jmri.jmrix.grapevine.SerialNode
public class SerialNode
Models a serial node.
Nodes are numbered ala their address, from 0 to 255. Node number 1 carries sensors 1 to 999, node 2 1001 to 1999 etc.
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 | |
|---|---|
static String[] |
boardNames
|
protected boolean |
hasActiveSensors
|
static int[] |
inputBits
|
protected int |
lastUsedSensor
|
static int |
NODE2000
|
static int |
NODE2002V1
|
static int |
NODE2002V6
|
protected int |
nodeType
|
protected byte[] |
outputArray
|
static int[] |
outputBits
|
protected boolean[] |
outputByteChanged
|
protected Sensor[] |
sensorArray
|
protected int[] |
sensorLastSetting
|
protected int[] |
sensorTempSetting
|
| Fields inherited from class jmri.jmrix.AbstractNode |
|---|
nodeAddress |
| Constructor Summary | |
|---|---|
SerialNode()
Assumes a node address of 0, and a node type of 0 (NODE2002V6) If this constructor is used, actual node address must be set using setNodeAddress, and actual node type using 'setNodeType' |
|
SerialNode(int address,
int type)
Creates a new SerialNode and initialize default instance variables address - Address of node on serial bus (0-255) type - a type constant from the class |
|
| Method Summary | |
|---|---|
protected boolean |
checkNodeAddress(int address)
Check for valid node address |
AbstractMRMessage |
createInitPacket()
Public Method to create Initialization packets (SerialMessage) for this node. |
AbstractMRMessage |
createOutPacket()
Public Method to create an Transmit packet (SerialMessage) |
int |
getNodeType()
Public method to return node type |
boolean |
handleTimeout(AbstractMRMessage m)
Deal with a timeout in the transmission controller. |
void |
markChanges(SerialReply l)
Use the contents of a reply from the Grapevine to mark changes in the sensors on the layout. |
void |
registerSensor(Sensor s,
int i)
The numbers here are 0 to MAXSENSORS, not 1 to MAXSENSORS. |
void |
resetMustSend()
Public to reset state of needSend flag. |
void |
resetTimeout(AbstractMRMessage m)
A reply was received, so there was not timeout, do any needed processing. |
boolean |
sensorsActive()
Public method to return state of Sensors. |
void |
setNodeType(int type)
Public method to set node type. |
void |
setOutputBit(int bitNumber,
boolean state)
Public method setting an output bit. |
| Methods inherited from class jmri.jmrix.AbstractNode |
|---|
getNodeAddress, mustSend, setMustSend, setNodeAddress |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NODE2002V6
public static final int NODE2002V1
public static final int NODE2000
public static final String[] boardNames
public static final int[] outputBits
public static final int[] inputBits
protected int nodeType
protected byte[] outputArray
protected boolean[] outputByteChanged
protected boolean hasActiveSensors
protected int lastUsedSensor
protected Sensor[] sensorArray
protected int[] sensorLastSetting
protected int[] sensorTempSetting
| Constructor Detail |
|---|
public SerialNode()
public SerialNode(int address,
int type)
| Method Detail |
|---|
public void setOutputBit(int bitNumber,
boolean state)
public boolean sensorsActive()
sensorsActive in class AbstractNodepublic void resetMustSend()
resetMustSend in class AbstractNodepublic int getNodeType()
public void setNodeType(int type)
protected boolean checkNodeAddress(int address)
checkNodeAddress in class AbstractNodepublic AbstractMRMessage createInitPacket()
As an Ugly Hack to keep these separate, only the first is put in the reply from this. The other(s) are sent via the usual output methods.
createInitPacket in class AbstractNodepublic AbstractMRMessage createOutPacket()
createOutPacket in class AbstractNodepublic void markChanges(SerialReply l)
l - Reply to a poll operation
public void registerSensor(Sensor s,
int i)
s - Sensor objecti - bit number corresponding, a 1-based value corresponding to the low
digits of the system namepublic boolean handleTimeout(AbstractMRMessage m)
AbstractNode
handleTimeout in class AbstractNodem - message that didn't receive a reply
public void resetTimeout(AbstractMRMessage m)
AbstractNode
resetTimeout in class AbstractNode
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||