Package jmri.jmrix

Class AbstractNode

    • Constructor Detail

      • AbstractNode

        public AbstractNode()
        Create a new instance of AbstractNode.
    • Method Detail

      • getNodeAddress

        public int getNodeAddress()
        Public method to return the node address.
        Returns:
        node address number
      • setNodeAddress

        public void setNodeAddress​(int address)
        Public method to set the node address. Address range is checked in subclasses.
        Parameters:
        address - address index to set in node
        Throws:
        java.lang.IllegalArgumentException - if out of range
      • checkNodeAddress

        protected abstract boolean checkNodeAddress​(int address)
        Check for valid address with respect to range, etc.
        Parameters:
        address - node number to check.
        Returns:
        true if valid
      • createInitPacket

        public abstract AbstractMRMessage createInitPacket()
        Create the needed Initialization packet (AbstractMRMessage) for this node.
        Returns:
        the packet, or 'null' if not needed
      • createOutPacket

        public abstract AbstractMRMessage createOutPacket()
        Create a Transmit packet (AbstractMRMessage) to send current state.
        Returns:
        packet to send current node state.
      • getSensorsActive

        public abstract boolean getSensorsActive()
        Are any sensors present, and hence will this node need to be polled?
        Returns:
        'true' if at least one sensor is active for this node
      • handleTimeout

        public abstract boolean handleTimeout​(AbstractMRMessage m,
                                              AbstractMRListener l)
        Deal with a timeout in the transmission controller.
        Parameters:
        m - message that didn't receive a reply
        l - listener that sent the message
        Returns:
        true if initialization is required
      • resetTimeout

        public abstract void resetTimeout​(AbstractMRMessage m)
        A reply was received, so there was no timeout, do any needed processing.
        Parameters:
        m - message received that has reset the timeout and is waiting to be handled
      • mustSend

        public boolean mustSend()
        Get Must Send state.
        Returns:
        state of needSend flag.
      • resetMustSend

        public void resetMustSend()
        Public to reset state of needSend flag. Subclasses may override to enforce conditions.
      • setMustSend

        public void setMustSend()
        Public to set state of needSend flag.