Class AcelaNode
Nodes are numbered from 0. The first watchman node carries the first 8 sensors 0 to 7, 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.
Same applies to the outputs (Dash-8s and Signalmen)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final bytestatic final intstatic final intstatic final bytestatic final intprotected intprotected intprotected booleanprotected int(package private) static final int(package private) static final int(package private) static final intMaximum number of sensors/outputs any node of any type can carry.(package private) static final String[](package private) static final String[]static final Stringprotected boolean(package private) static final String[]protected intstatic final intprotected byte[]protected intprotected int[]static final Stringstatic final Stringprotected int[]protected boolean[]static final Stringstatic final Stringprotected int[]static final Stringprotected int[]protected int[]static final Stringprotected int[]static final Stringstatic final intstatic final byteprotected Sensor[]protected intprotected byte[]protected boolean[]protected int[]protected boolean[]static final Stringprotected int[]protected int[]protected int[]static final Stringstatic final byteprotected intprotected intstatic final bytestatic final bytestatic final byte(package private) intprotected intstatic final intstatic final intstatic final byte(package private) booleanstatic final intstatic final bytestatic final byteFields inherited from class jmri.jmrix.AbstractNode
nodeAddress -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new AcelaNode instance on the TrafficController associated with the default AcelaSystemConnectionMemo.AcelaNode(int address, int type, AcelaTrafficController tc) Create a new AcelaNode instance and initialize default instance variables. -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckNodeAddress(int address) Check for valid address with respect to range, etc.Create the needed Initialization packet (AbstractMRMessage) for this node.Create a Transmit packet (SerialMessage) to send current state.intGet ending output address for range.intGet ending sensor addresses for range.static String[]static String[]intPublic method to return node type.intPublic method to return number of bits per card.intbooleangetOutputBit(int bitNumber) Get the current state of an output bit.intgetOutputInit(int circuitnum) getOutputInitString(int circuitnum) intgetOutputLength(int circuitnum) intgetOutputSignalHeadType(int circuitnum) getOutputSignalHeadTypeString(int circuitnum) intgetOutputSpecial(int circuitnum) intgetOutputType(int circuitnum) getOutputTypeString(int circuitnum) intgetOutputWired(int circuitnum) Get Output configuration values.getOutputWiredString(int circuitnum) intGet the number of sensor bits per node.intgetSensorPolarity(int circuitnum) getSensorPolarityString(int circuitnum) booleanAre any sensors present, and hence will this node need to be polled?intgetSensorThreshold(int circuitnum) intgetSensorType(int circuitnum) Public method to set and return Sensor configuration values.getSensorTypeString(int circuitnum) intGet starting output address for range.intGet starting sensor addresses for range.intGet the transmission delay on this node.booleanDeal with a timeout in the transmission controller.voidinitNode()voidUse the contents of the poll reply to mark changes.voidregisterSensor(Sensor s, int rawaddr) Register a sensor on an Acela node.voidA reply was received, so there was no timeout, do any needed processing.voidsetEndingOutputAddress(int endingAddress) Set ending output address for range.voidsetEndingSensorAddress(int endingAddress) Set ending sensor addresses for range.voidsetNodeType(int type) voidsetNodeTypeString(String stringtype) Public method to set node type.voidsetOutputBit(int bitNumber, boolean state) Set an output bit on this node.voidsetOutputInit(int circuitnum, int type) voidsetOutputInitString(int circuitnum, String stringtype) voidsetOutputLength(int circuitnum, int newlength) voidsetOutputSignalHeadType(int circuitnum, int type) voidsetOutputSignalHeadTypeString(int circuitnum, String stringtype) voidsetOutputSpecial(int circuitnum, int type) voidsetOutputType(int circuitnum, int type) voidsetOutputTypeString(int circuitnum, String stringtype) voidsetOutputWired(int circuitnum, int type) Set Output configuration values.voidsetOutputWiredString(int circuitnum, String stringtype) voidsetSensorPolarity(int circuitnum, int polarity) voidsetSensorPolarityString(int circuitnum, String stringpolarity) voidsetSensorThreshold(int circuitnum, int threshold) voidsetSensorType(int circuitnum, int type) voidsetSensorTypeString(int circuitnum, String stringtype) voidsetStartingOutputAddress(int startingAddress) Set starting output address for range.voidsetStartingSensorAddress(int startingAddress) Set starting sensor address for range.voidsetTransmissionDelay(int delay) Set transmission delay.Methods inherited from class jmri.jmrix.AbstractNode
getNodeAddress, mustSend, resetMustSend, setMustSend, setNodeAddress
-
Field Details
-
MAXSENSORBITS
Maximum number of sensors/outputs any node of any type can carry.- See Also:
-
MAXOUTPUTBITS
- See Also:
-
MAXNODE
- See Also:
-
AC
- See Also:
-
TB
- See Also:
-
D8
- See Also:
-
WM
- See Also:
-
SM
- See Also:
-
SC
- See Also:
-
SW
- See Also:
-
YM
- See Also:
-
SY
- See Also:
-
UN
- See Also:
-
moduleTypes
- See Also:
-
nodeNames
-
moduleNames
-
moduleTips
-
nodeType
-
outputbitsPerCard
-
sensorbitsPerCard
-
transmissionDelay
-
needInit
-
outputArray
-
outputSpecial
-
outputSignalHeadType
-
hasActiveSensors
-
lastUsedSensor
-
sensorArray
-
sensorNeedInit
-
sensorHasBeenInit
-
sensorLastSetting
-
sensorType
-
sensorPolarity
-
sensorThreshold
-
sensorConfigArray
-
outputWired
-
outputInit
-
outputType
-
outputLength
-
outputNeedToSend
-
sensorTypes
- See Also:
-
sensorPolarities
- See Also:
-
outputWireds
- See Also:
-
outputInits
- See Also:
-
outputTypes
- See Also:
-
ONOFF
- See Also:
-
PULSE
- See Also:
-
BLINK
- See Also:
-
outputSignalHeadTypes
- See Also:
-
UKNOWN
- See Also:
-
DOUBLE
- See Also:
-
TRIPLE
- See Also:
-
BPOLAR
- See Also:
-
WIGWAG
- See Also:
-
outputONOFF
- See Also:
-
outputLEN0
- See Also:
-
outputNO
- See Also:
-
startingOutputAddress
-
endingOutputAddress
-
startingSensorAddress
-
endingSensorAddress
-
warned
boolean warned -
timeout
int timeout
-
-
Constructor Details
-
AcelaNode
public AcelaNode()Create a new AcelaNode instance on the TrafficController associated with the default AcelaSystemConnectionMemo.Assumes a node address of 0, and a node type of NO_CARD. If this constructor is used, actual node address must be set using
AbstractNode.setNodeAddress(int)and actual node type usingsetNodeType(int) -
AcelaNode
Create a new AcelaNode instance and initialize default instance variables.- Parameters:
address- the address of first bit on Acela bus (0-1023) type - D8, SM, WMtype- a type constant from the classtc- the TrafficControllerfor this connection
-
-
Method Details
-
getNodeNames
-
getModuleNames
-
initNode
-
setStartingOutputAddress
Set starting output address for range. Used to help linear address search.- Parameters:
startingAddress- starting output address for range.
-
getStartingOutputAddress
Get starting output address for range. Used to help linear address search.- Returns:
- starting output address.
-
setEndingOutputAddress
Set ending output address for range. Used to help linear address search.- Parameters:
endingAddress- end output address for range.
-
getEndingOutputAddress
Get ending output address for range. Used to help linear address search.- Returns:
- end output address for range.
-
setStartingSensorAddress
Set starting sensor address for range. Used to help linear address search.- Parameters:
startingAddress- start sensor address for range.
-
getStartingSensorAddress
Get starting sensor addresses for range. Used to help linear address search.- Returns:
- starting sensor address for range.
-
setEndingSensorAddress
Set ending sensor addresses for range. Used to help linear address search.- Parameters:
endingAddress- end sensor address.
-
getEndingSensorAddress
Get ending sensor addresses for range. Used to help linear address search.- Returns:
- end of range sensor address.
-
setOutputBit
Set an output bit on this node.- Parameters:
bitNumber- the bit to setstate- bit state to set: 'true' for 0, 'false' for 1
-
getOutputBit
Get the current state of an output bit.- Parameters:
bitNumber- the bit. Bits are numbered from 0 for Acela- Returns:
- 'true' for 0, 'false' for 1
-
getSensorsActive
Are any sensors present, and hence will this node need to be polled?- Specified by:
getSensorsActivein classAbstractNode- Returns:
- 'true' if at least one sensor is active for this node
-
getOutputWired
Get Output configuration values.- Parameters:
circuitnum- wired output index number.- Returns:
- configuration value.
-
getOutputWiredString
-
setOutputWired
Set Output configuration values.- Parameters:
circuitnum- output index number.type- output type.
-
setOutputWiredString
-
getOutputInit
-
getOutputInitString
-
setOutputInit
-
setOutputInitString
-
getOutputType
-
getOutputTypeString
-
setOutputType
-
setOutputTypeString
-
getOutputLength
-
setOutputLength
-
getOutputSpecial
-
setOutputSpecial
-
getOutputSignalHeadType
-
getOutputSignalHeadTypeString
-
setOutputSignalHeadType
-
setOutputSignalHeadTypeString
-
getSensorType
Public method to set and return Sensor configuration values.- Parameters:
circuitnum- sensor type array index number.- Returns:
- sensor index value.
-
getSensorTypeString
-
setSensorType
-
setSensorTypeString
-
getSensorPolarity
-
getSensorPolarityString
-
setSensorPolarity
-
setSensorPolarityString
-
getSensorThreshold
-
setSensorThreshold
-
getNodeType
Public method to return node type.- Returns:
- node type number.
-
getNodeTypeString
-
setNodeTypeString
Public method to set node type.- Parameters:
stringtype- string form of node type.
-
setNodeType
-
getNumOutputBitsPerCard
Public method to return number of bits per card.- Returns:
- number of output bits per card.
-
getNumSensorBitsPerCard
-
checkNodeAddress
Check for valid address with respect to range, etc.- Specified by:
checkNodeAddressin classAbstractNode- Parameters:
address- node number to check.- Returns:
- true if valid
-
getSensorBitsPerCard
Get the number of sensor bits per node.- Returns:
- sensorbitsPerCard
-
getTransmissionDelay
Get the transmission delay on this node.- Returns:
- delay in 10s of microseconds.
-
setTransmissionDelay
Set transmission delay.Note: two bytes are used, so range is 0-65,535. If delay is out of range, it is restricted to the allowable range.
- Parameters:
delay- a delay between bytes on receive (units of 10 microsec.)
-
createInitPacket
Create the needed Initialization packet (AbstractMRMessage) for this node.- Specified by:
createInitPacketin classAbstractNode- Returns:
- the packet, or 'null' if not needed
-
createOutPacket
Create a Transmit packet (SerialMessage) to send current state.- Specified by:
createOutPacketin classAbstractNode- Returns:
- packet to send current node state.
-
markChanges
Use the contents of the poll reply to mark changes.- Parameters:
l- Reply to a poll operation
-
registerSensor
Register a sensor on an Acela node. The numbers here are 0 to MAXSENSORBITS, not 1 to MAXSENSORBITS.- Parameters:
s- Sensor objectrawaddr- index number of sensor's input bit on this node, valid range from 0 to MAXSENSORBITS
-
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
-