Package jmri.jmrix

Class AbstractMRNodeTrafficController

    • Field Detail

      • numNodes

        protected volatile int numNodes
        Total number of SerialNodes registered with this TrafficController. Incremented as Serial Nodes are created and registered. Corresponds to the next available address in nodeArray.
      • curSerialNodeIndex

        protected int curSerialNodeIndex
        Working variable for keeping track of the active node, if any.
    • Method Detail

      • init

        protected void init​(int minNode,
                            int maxNode)
        Initialize based on number of first and last nodes.
        Parameters:
        minNode - lowest node number, usually 0
        maxNode - highest node number
      • getMustInit

        protected boolean getMustInit​(int i)
        Does a given node need to have initialization data sent?
        Parameters:
        i - the node address (number)
        Returns:
        true if initialization data is required
      • setMustInit

        protected void setMustInit​(int i,
                                   boolean v)
        Mark whether a given node needs to have initialization data sent.
        Parameters:
        i - the node index
        v - true if set to require sending initialization data
      • getNumNodes

        public int getNumNodes()
        Get the total number of currently registered nodes.
        Returns:
        the number of registerd nodes on this connection
      • registerNode

        public void registerNode​(AbstractNode node)
        Register a Serial node on this TrafficController.
        Parameters:
        node - the node object to register
      • getNode

        public AbstractNode getNode​(int index)
        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

        public AbstractNode getNodeFromAddress​(int addr)
        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

        public void deleteNode​(int nodeAddress)
        Delete a SerialNode by node address.
        Parameters:
        nodeAddress - address number for the node to be deleted