Class NceTurnout

    • Constructor Detail

      • NceTurnout

        public NceTurnout​(NceTrafficController tc,
                          java.lang.String p,
                          int i)
        NCE turnouts use the NMRA number (0-2044) as their numerical identification.
        Parameters:
        tc - traffic controller for connection
        p - system connection prefix
        i - NMRA turnout number
    • Method Detail

      • 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
      • setCommandedStateFromCS

        void setCommandedStateFromCS​(int state)
        Set the turnout known state to reflect what's been observed from the command station polling. A change there means that somebody commanded a state change (by using a throttle), and that command has already taken effect. Hence we use "newCommandedState" to indicate it's taken place. Must be followed by "newKnownState" to complete the turnout action.
        Parameters:
        state - Observed state, updated state from command station
      • setKnownStateFromCS

        void setKnownStateFromCS​(int state)
        Set the turnout known state to reflect what's been observed from the command station polling. A change there means that somebody commanded a state change (by using a throttle), and that command has already taken effect. Hence we use "newKnownState" to indicate it's taken place.
        Parameters:
        state - Observed state, updated state from command station
      • canLock

        public boolean canLock​(int turnoutLockout)
        NCE turnouts support two types of lockouts, pushbutton and cab. Cab lockout requires the feedback mode to be Monitoring. This implementation by itself doesn't provide locking support. Override this in subclasses that do.
        Specified by:
        canLock in interface Turnout
        Overrides:
        canLock in class AbstractTurnout
        Parameters:
        turnoutLockout - the type of lock, one of CABLOCKOUT, PUSHBUTTONLOCKOUT or BOTH = CABLOCKOUT | PUSHBUTTONLOCKOUT
        Returns:
        false for not supported
      • enableLockOperation

        public void enableLockOperation​(int turnoutLockout,
                                        boolean enabled)
        Control which turnout locks are enabled. Enable turnout lock operators. A turnout can be locked to prevent it being thrown from a cab or push button on the layout if supported by the protocol. Not implemented in AbstractTurnout.
        Specified by:
        enableLockOperation in interface Turnout
        Overrides:
        enableLockOperation in class AbstractTurnout
        Parameters:
        turnoutLockout - the type of lock
        enabled - true if locking is enabled for the given type; false otherwise
      • sendMessage

        protected void sendMessage​(boolean closed)