Class XNetLight

All Implemented Interfaces:
Comparable<NamedBean>, EventListener, PropertyChangeProvider, DigitalIO, AbstractMRListener, XNetListener, Light, NamedBean

public class XNetLight extends AbstractLight implements XNetListener
Implementation of the Light Object for XpressNet.

NOTE: This is a simplification of the XNetTurnout class.

Based in part on SerialLight.java

  • Field Details

  • Constructor Details

    • XNetLight

      Create a Light object, with only system name.

      'systemName' was previously validated in LnLightManager

      Parameters:
      tc - the traffic controller for the connection
      lm - the managing LightManager for this Light
      systemName - the system name for this Light
    • XNetLight

      public XNetLight(XNetTrafficController tc, XNetLightManager lm, String systemName, String userName)
      Create a Light object, with both system and user names.

      'systemName' was previously validated in XNetLightManager

      Parameters:
      tc - the traffic controller for the connection
      lm - the managing LightManager for this Light
      systemName - the system name for this Light
      userName - the user name for this Light
  • Method Details

    • dispose

      public void dispose()
      Dispose of the light object.
      Specified by:
      dispose in interface NamedBean
      Overrides:
      dispose in class AbstractNamedBean
    • setState

      public void setState(int newState)
      Set the current state of this Light. This routine requests the hardware to change.
      Specified by:
      setState in interface Light
      Specified by:
      setState in interface NamedBean
      Overrides:
      setState in class AbstractLight
      Parameters:
      newState - new state
    • message

      public void message(XNetReply l)
      Handle an incoming message from the XpressNet. NOTE: We aren't registered as a listener, so this is only triggered when we send out a message.
      Specified by:
      message in interface XNetListener
      Parameters:
      l - the message to handle
    • message

      public void message(XNetMessage l)
      Listen for the messages to the LI100/LI101.
      Specified by:
      message in interface XNetListener
      Parameters:
      l - the expected message
    • notifyTimeout

      public void notifyTimeout(XNetMessage msg)
      Description copied from interface: XNetListener
      Member function invoked by an XNetInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.
      Specified by:
      notifyTimeout in interface XNetListener
      Parameters:
      msg - message which has timed out.