Package jmri.jmrix.secsi
Class SerialNode
java.lang.Object
jmri.jmrix.AbstractNode
jmri.jmrix.secsi.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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intprotected boolean(package private) static final int[]protected int(package private) static final intMaximum number of sensors a node can carry.(package private) static final intprotected intprotected boolean[]protected boolean[](package private) static final int[]protected Sensor[]protected int[]protected int[](package private) int(package private) booleanFields inherited from class jmri.jmrix.AbstractNode
nodeAddress -
Constructor Summary
ConstructorsConstructorDescriptionSerialNode(int address, int type, SerialTrafficController _tc) Create a new SerialNode and initialize default instance variables.Assumes a node address of 0, and a node type of 0 (IO24) If this constructor is used, actual node address must be set using setNodeAddress, and actual node type using 'setNodeType' -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckNodeAddress(int address) Check for valid node address.Create an Initialization packet (SerialMessage) for this node.Create a Transmit packet (SerialMessage).static String[]intPublic method to return node type.booleanGet state of Sensors.booleanDeal with a timeout in the transmission controller.voidUse the contents of the poll reply to mark changes.voidregisterSensor(Sensor s, int i) The numbers here are 0 to MAXSENSORS, not 1 to MAXSENSORS.voidA reply was received, so there was no timeout, do any needed processing.voidsetNodeType(int type) Set node type.voidsetOutputBit(int bitNumber, boolean state) Set an output bit on this node.(package private) voidMethods inherited from class jmri.jmrix.AbstractNode
getNodeAddress, mustSend, resetMustSend, setMustSend, setNodeAddress
-
Field Details
-
MAXSENSORS
Maximum number of sensors a node can carry.Note this is less than a current SUSIC motherboard can have, but should be sufficient for all reasonable layouts.
Must be less than,
SerialSensorManager.SENSORSPERNODE- See Also:
-
MAXTURNOUTS
- See Also:
-
DAUGHTER
- See Also:
-
CABDRIVER
- See Also:
-
outputBits
-
inputBits
-
nodeType
-
outputArray
-
outputBitChanged
-
hasActiveSensors
-
lastUsedSensor
-
sensorArray
-
sensorLastSetting
-
sensorTempSetting
-
warned
boolean warned -
timeout
int timeout
-
-
Constructor Details
-
SerialNode
Assumes a node address of 0, and a node type of 0 (IO24) If this constructor is used, actual node address must be set using setNodeAddress, and actual node type using 'setNodeType'- Parameters:
_tc- system connection traffic controller.
-
SerialNode
Create a new SerialNode and initialize default instance variables.- Parameters:
address- address of node on serial bus (0-255)type- a type constant from the class_tc- connected TafficController
-
-
Method Details
-
getBoardNames
-
setOutputBit
Set an output bit on this node.- Parameters:
bitNumber- the bit on node to set (numbered from 1; not 0)state- 'true' for 0, 'false' for 1.
-
getSensorsActive
Get state of Sensors.- Specified by:
getSensorsActivein classAbstractNode- Returns:
- 'true' if at least one sensor is active for this node
-
getNodeType
Public method to return node type. Current types are: DAUGHTER, CABDRIVER- Returns:
- node type.
-
setNodeType
Set node type.- Parameters:
type- node type, e.g. DAUGHTER or CABDRIVER
-
checkNodeAddress
Check for valid node address.- Specified by:
checkNodeAddressin classAbstractNode- Parameters:
address- node number to check.- Returns:
- true if valid
-
createInitPacket
Create an Initialization packet (SerialMessage) for this node.- Specified by:
createInitPacketin classAbstractNode- Returns:
- null as there are currently no SECSI boards that need an init message
-
createOutPacket
Create a Transmit packet (SerialMessage).- Specified by:
createOutPacketin classAbstractNode- Returns:
- packet to send current node state.
-
warn
-
markChanges
Use the contents of the poll reply to mark changes. TODO For Secsi Simulator, needs more work to create correct reply.- Parameters:
l- Reply to a poll operation
-
registerSensor
The numbers here are 0 to MAXSENSORS, not 1 to MAXSENSORS.- Parameters:
s- Sensor objecti- number of sensor's input bit on this node (0 to MAXSENSORS)
-
handleTimeout
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 is required
-
resetTimeout
A 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
-