Class SerialNode

java.lang.Object
jmri.jmrix.AbstractNode
jmri.jmrix.secsi.SerialNode

public class SerialNode extends AbstractNode
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 Details

  • 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

      public SerialNode(int address, int type, SerialTrafficController _tc)
      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

      public static String[] getBoardNames()
    • setOutputBit

      public void setOutputBit(int bitNumber, boolean state)
      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

      public boolean getSensorsActive()
      Get state of Sensors.
      Specified by:
      getSensorsActive in class AbstractNode
      Returns:
      'true' if at least one sensor is active for this node
    • getNodeType

      public int getNodeType()
      Public method to return node type. Current types are: DAUGHTER, CABDRIVER
      Returns:
      node type.
    • setNodeType

      public void setNodeType(int type)
      Set node type.
      Parameters:
      type - node type, e.g. DAUGHTER or CABDRIVER
    • checkNodeAddress

      protected boolean checkNodeAddress(int address)
      Check for valid node address.
      Specified by:
      checkNodeAddress in class AbstractNode
      Parameters:
      address - node number to check.
      Returns:
      true if valid
    • createInitPacket

      Create an Initialization packet (SerialMessage) for this node.
      Specified by:
      createInitPacket in class AbstractNode
      Returns:
      null as there are currently no SECSI boards that need an init message
    • createOutPacket

      Create a Transmit packet (SerialMessage).
      Specified by:
      createOutPacket in class AbstractNode
      Returns:
      packet to send current node state.
    • warn

      void warn(String s)
    • markChanges

      public void markChanges(SerialReply l)
      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

      public void registerSensor(Sensor s, int i)
      The numbers here are 0 to MAXSENSORS, not 1 to MAXSENSORS.
      Parameters:
      s - Sensor object
      i - number of sensor's input bit on this node (0 to MAXSENSORS)
    • handleTimeout

      Deal with a timeout in the transmission controller.
      Specified by:
      handleTimeout in class AbstractNode
      Parameters:
      m - message that didn't receive a reply
      l - 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:
      resetTimeout in class AbstractNode
      Parameters:
      m - message received that has reset the timeout and is waiting to be handled