Class DCCppLight

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

public class DCCppLight
extends AbstractLight
implements DCCppListener
Implementation of the Light Object for DCC++

NOTE: This is a simplification of the DCCppTurnout class.

Based in part on SerialLight.java

  • Field Details

  • Constructor Details

    • DCCppLight

      public DCCppLight​(DCCppTrafficController tc, DCCppLightManager lm, String systemName)
      Create a Light object, with only system name.

      'systemName' was previously validated in DCCppLightManager

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

      public DCCppLight​(DCCppTrafficController tc, DCCppLightManager lm, String systemName, String userName)
      Create a Light object, with both system and user names.

      'systemName' was previously validated in DCCppLightManager

      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​(DCCppReply l)
      Member function that will be invoked by a DCCppInterface implementation to forward a DCC++ message from the layout. Handle an incoming message from the DCC++ Base Station.

      NOTE: We aren't registered as a listener, so this is only triggered when we send out a message

      Specified by:
      message in interface DCCppListener
      Parameters:
      l - The received DCC++ message. Note that this same object may be presented to multiple users. It should not be modified here.
    • message

      public void message​(DCCppMessage l)
      Member function that will be invoked by a DCCppInterface implementation to forward a DCC++ message sent to the layout. Normally, this function will do nothing. Listen for messages to the DCC++ Base Station.
      Specified by:
      message in interface DCCppListener
      Parameters:
      l - The received DCC++ message. Note that this same object may be presented to multiple users. It should not be modified here.
    • notifyTimeout

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