Class SerialTurnout

All Implemented Interfaces:
PropertyChangeListener, Comparable<NamedBean>, EventListener, PropertyChangeProvider, DigitalIO, NamedBean, Turnout, VariableControlSpanBean

public class SerialTurnout extends AbstractTurnout
Turnout implementation for Maple systems.

This object doesn't listen to the interface communications. This is because it should be the only object that is sending messages for this turnout; more than one Turnout object pointing to a single device is not allowed.

Turnouts on the layout may be controlled by one or two output bits. To control a turnout from one Turnout object via two output bits, the output bits must be on the same node, the Turnout address must point to the first output bit, and the second output bit must follow the output bit at the next address. Valid states for the two bits controlling the two-bit turnout are: ON OFF, and OFF ON for the two bits.

This class can also drive pulsed outputs, which can be combined with the two-bit option in the expected ways.

When a Turnout is configured for pulsed and two-output, a request to go to a new CommandedState sets the desired configuration for the pulse interval, then sets both leads to their off condition.

When a Turnout is configured for pulsed and one output, a request to go to a new CommandedState just sets the output on for the interval; it's assumed that there's something out on the layout that converts that pulse into a "flip to other state" operation.

Finally, this implementation supports the "inverted" option. Inverted applies to the status of the lead on the output itself.

For example, a pulsed, two-output, inverted turnout will have both pins set to 1 in the resting state. When THROWN, one lead will be set to 0 for the configured interval, then set back to 1.

For more discussion of this, please see the documentation page (for C/MRI, but this is similar). NOTE: In the current version Maple support, code for implementing pulsed turnouts has been commented out.

  • Field Details

  • Constructor Details

    • SerialTurnout

      public SerialTurnout(String systemName, String userName, MapleSystemConnectionMemo memo)
      Create a Turnout object, with both system and user names.

      'systemName' has already been validated in SerialTurnoutManager

      Parameters:
      systemName - the system name for this Turnout
      userName - the user name for this Turnout
      memo - the memo for the system connection
    • SerialTurnout

      public SerialTurnout(String systemName, MapleSystemConnectionMemo memo)
      Create a Turnout object, with only a system name.

      'systemName' has already been validated in SerialTurnoutManager

      Parameters:
      systemName - the system name for this Turnout
      memo - the memo for the system connection
  • Method Details

    • forwardCommandChangeToLayout

      protected void forwardCommandChangeToLayout(int newState)
      Handle a request to change state, typically by sending a message to the layout in some child class. Public version (used by TurnoutOperator) sends the current commanded state without changing it. Implementing classes will typically check the value of s and send a system specific sendMessage command.
      Specified by:
      forwardCommandChangeToLayout in class AbstractTurnout
      Parameters:
      newState - new state value
    • canInvert

      public boolean canInvert()
      Turnouts do support inversion.
      Specified by:
      canInvert in interface Turnout
      Overrides:
      canInvert in class AbstractTurnout
      Returns:
      invert supported
    • turnoutPushbuttonLockout

      protected void turnoutPushbuttonLockout(boolean _pushButtonLockout)
      Specified by:
      turnoutPushbuttonLockout in class AbstractTurnout
    • sendMessage

      protected void sendMessage(boolean closed)
      Control the actual layout hardware. The request is for a particular functional setting, e.g. CLOSED or THROWN. The "inverted" status of the output leads is handled here.
      Parameters:
      closed - true sets the Turnout to CLOSED