Class BiDiBNodeInitializer

java.lang.Object
jmri.jmrix.bidib.BiDiBNodeInitializer
All Implemented Interfaces:
Runnable

public class BiDiBNodeInitializer extends Object implements Runnable
This class initializes or deinitializes a BiDiB node when it is found on system startup or if it is discovered or lost while the system is running.\ The real work is done in its own thread and from a node queue. Initializing is a time consuming process since a lot of data is read from the node.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BiDiBNodeInitializer(BiDiBTrafficController tc, org.bidib.jbidibc.core.BidibInterface bidib, Map<Long,org.bidib.jbidibc.messages.Node> nodes)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Get data from root node and from all other nodes
    void
    Remove all nodes
    void
    initNode(org.bidib.jbidibc.messages.Node node)
    Get everything we need from the node.
    void
    nodeLost(org.bidib.jbidibc.messages.Node node)
    Remove a node from all named beans and from the nodes list
    void
    nodeNew(org.bidib.jbidibc.messages.Node node)
    Add a node to nodes list and notify all named beans to update
    void
    run()
    Execute queued node init and named beans update.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • initNode

      public void initNode(org.bidib.jbidibc.messages.Node node) throws org.bidib.jbidibc.messages.exception.ProtocolException
      Get everything we need from the node. The node must already be inserted into the BiDiB node list.
      Parameters:
      node - node to initialize
      Throws:
      org.bidib.jbidibc.messages.exception.ProtocolException - when features can't be loaded
    • nodeLost

      public void nodeLost(org.bidib.jbidibc.messages.Node node)
      Remove a node from all named beans and from the nodes list
      Parameters:
      node - to remove
    • nodeNew

      public void nodeNew(org.bidib.jbidibc.messages.Node node)
      Add a node to nodes list and notify all named beans to update
      Parameters:
      node - to add
    • connectionLost

      public void connectionLost()
      Remove all nodes
    • connectionInit

      public boolean connectionInit()
      Get data from root node and from all other nodes
      Returns:
      true on success
    • run

      public void run()
      Execute queued node init and named beans update. Finish the thread if the queue is empty
      Specified by:
      run in interface Runnable