Package jmri.jmrix
Class AbstractMRNodeTrafficController
java.lang.Object
jmri.jmrix.AbstractMRTrafficController
jmri.jmrix.AbstractMRNodeTrafficController
- Direct Known Subclasses:
AcelaTrafficController,IEEE802154TrafficController,SerialTrafficController,SerialTrafficController,SerialTrafficController,SerialTrafficController,SerialTrafficController
Abstract Traffic Controller base class for those implementations that track a
set of nodes.
The nodes are descendents of AbstractNode. Provides node
management services, but no additional protocol.
-
Nested Class Summary
Nested classes/interfaces inherited from class jmri.jmrix.AbstractMRTrafficController
AbstractMRTrafficController.RcvNotifier, AbstractMRTrafficController.XmtNotifier -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intWorking variable for keeping track of the active node, if any.protected intprotected intprotected AbstractNode[]protected intTotal number of SerialNodes registered with this TrafficController.Fields inherited from class jmri.jmrix.AbstractMRTrafficController
allowUnexpectedReply, AUTORETRYSTATE, cmdListeners, connectionError, controller, flushReceiveChars, IDLESTATE, istream, listenerQueue, maxRcvExceptionCount, mCurrentMode, mCurrentState, mLastSender, msgQueue, mWaitBeforePoll, NORMALMODE, NOTIFIEDSTATE, OKSENDMSGSTATE, ostream, POLLSTATE, PROGRAMINGMODE, rcvException, rcvThread, replyInDispatch, threadStopRequest, timeoutFlag, timeouts, WAITMSGREPLYSTATE, WAITREPLYINNORMMODESTATE, WAITREPLYINPROGMODESTATE, waitTimePoll, xmtException, xmtRunnable, xmtThread -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new unnamed MRNodeTrafficController instance. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteNode(int nodeAddress) Delete a SerialNode by node address.protected booleangetMustInit(int i) Does a given node need to have initialization data sent?getNode(int index) Get the Serial node for a given index as registered with this TrafficController.getNodeFromAddress(int addr) Identify a SerialNode from its node address.intGet the total number of currently registered nodes.protected voidinit(int minNode, int maxNode) Initialize based on number of first and last nodes.voidregisterNode(AbstractNode node) Register a Serial node on this TrafficController.protected voidsetMustInit(int i, boolean v) Mark whether a given node needs to have initialization data sent.protected voidsetMustInit(AbstractNode node, boolean v) Methods inherited from class jmri.jmrix.AbstractMRTrafficController
addConsoleListener, addHeaderToOutput, addListener, addTrailerToOutput, canReceive, connectionWarn, connectPort, disconnectPort, distributeReply, endOfMessage, enterNormalMode, enterProgMode, enterProgModeDelayTime, forwardMessage, forwardReply, forwardToPort, getLastSender, getPortName, getSynchronizeRx, handleOneIncomingReply, handleTimeout, hasTimeouts, lengthOfByteStream, loadChars, newRcvNotifier, newReply, notifyMessage, notifyReply, pollMessage, pollReplyHandler, portReadyToSend, portWarn, portWarnTCP, programmerIdle, readByteProtected, receiveLoop, recovery, removeListener, reportReceiveLoopException, resetTimeout, sendMessage, setAllowUnexpectedReply, setSynchronizeRx, status, terminate, terminateThreads, transmitLoop, transmitWait, unexpectedReplyStateError, waitForStartOfReply, warnOnTimeout
-
Field Details
-
minNode
-
maxNode
-
numNodes
Total number of SerialNodes registered with this TrafficController. Incremented as Serial Nodes are created and registered. Corresponds to the next available address innodeArray. -
nodeArray
-
curSerialNodeIndex
Working variable for keeping track of the active node, if any.
-
-
Constructor Details
-
AbstractMRNodeTrafficController
public AbstractMRNodeTrafficController()Create a new unnamed MRNodeTrafficController instance.
-
-
Method Details
-
init
Initialize based on number of first and last nodes.- Parameters:
minNode- lowest node number, usually 0maxNode- highest node number
-
getMustInit
Does a given node need to have initialization data sent?- Parameters:
i- the node address (number)- Returns:
- true if initialization data is required
-
setMustInit
Mark whether a given node needs to have initialization data sent.- Parameters:
i- the node indexv- true if set to require sending initialization data
-
setMustInit
-
getNumNodes
Get the total number of currently registered nodes.- Returns:
- the number of registerd nodes on this connection
-
registerNode
Register a Serial node on this TrafficController.- Parameters:
node- the node object to register
-
getNode
Get the Serial node for a given index as registered with this TrafficController.- Parameters:
index- the index number of the node. To cycle through all nodes, begin with index=0, and increment your index at each call.- Returns:
- the node at index, 'null' when index exceeds the number of defined nodes
-
getNodeFromAddress
Identify a SerialNode from its node address.- Parameters:
addr- the node address, numbered from 0- Returns:
- the node at node address, 'null' if a SerialNode with the specified address was not found
-
deleteNode
Delete a SerialNode by node address.- Parameters:
nodeAddress- address number for the node to be deleted
-