jmri.jmrix.maple
Class SerialTurnout

java.lang.Object
  extended by jmri.implementation.AbstractNamedBean
      extended by jmri.implementation.AbstractTurnout
          extended by jmri.jmrix.maple.SerialTurnout
All Implemented Interfaces:
PropertyChangeListener, Serializable, EventListener, NamedBean, Turnout

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.

Author:
Bob Jacobsen Copyright (C) 2003, 2007, 2008, David Duchamp Copyright (C) 2004, 2007, Dan Boudreau Copyright (C) 2007
See Also:
Serialized Form

Field Summary
protected  Timer mPulseClosedTimer
           
protected  Timer mPulseThrownTimer
           
protected  boolean mPulseTimerOn
           
protected  int tBit
           
 
Fields inherited from class jmri.implementation.AbstractTurnout
_activeFeedbackType, _cabLockout, _decoderName, _enableCabLockout, _enablePushButtonLockout, _inverted, _pushButtonLockout, _reportLocked, _validDecoderNames, _validFeedbackModes, _validFeedbackNames, _validFeedbackTypes, binaryOutput, inhibitOperation, myOperator, myTurnoutOperation
 
Fields inherited from class jmri.implementation.AbstractNamedBean
mSystemName, mUserName
 
Fields inherited from interface jmri.Turnout
CABLOCKOUT, CLOSED, DIRECT, EXACT, INDIRECT, LOCKED, MONITORING, ONESENSOR, PUSHBUTTONLOCKOUT, SIGNAL, THROWN, TWOSENSOR, UNLOCKED
 
Fields inherited from interface jmri.NamedBean
INCONSISTENT, UNKNOWN
 
Constructor Summary
SerialTurnout(String systemName, String userName)
          Create a Turnout object, with both system and user names.
 
Method Summary
 boolean canInvert()
          Turnouts do support inversion
protected  void forwardCommandChangeToLayout(int newState)
          Handle a request to change state by sending a turnout command
protected  void sendMessage(boolean closed)
          Control the actual layout hardware.
protected  void turnoutPushbuttonLockout(boolean _pushButtonLockout)
           
 
Methods inherited from class jmri.implementation.AbstractTurnout
canLock, dispose, enableLockOperation, forwardCommandChangeToLayout, getCommandedState, getControlType, getCurrentOperator, getDecoderName, getDivergingLimit, getDivergingSpeed, getFeedbackMode, getFeedbackModeForOperation, getFeedbackModeName, getFirstNamedSensor, getFirstSensor, getInhibitOperation, getInverted, getKnownState, getLocked, getNumberOutputBits, getReportLocked, getSecondNamedSensor, getSecondSensor, getState, getStraightLimit, getStraightSpeed, getTurnoutOperation, getTurnoutOperator, getValidDecoderNames, getValidFeedbackNames, getValidFeedbackTypes, isConsistentState, newCommandedState, newKnownState, operationPropertyChange, propertyChange, provideFirstFeedbackNamedSensor, provideFirstFeedbackSensor, provideSecondFeedbackNamedSensor, provideSecondFeedbackSensor, sensorPropertyChange, setBinaryOutput, setCommandedState, setControlType, setDecoderName, setDivergingSpeed, setFeedbackMode, setFeedbackMode, setInhibitOperation, setInitialKnownStateFromFeedback, setInverted, setLocked, setNumberOutputBits, setReportLocked, setState, setStraightSpeed, setTurnoutOperation, turnoutPushbuttonLockout
 
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName, updateListenerRef
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, getComment, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName, updateListenerRef
 

Field Detail

tBit

protected int tBit

mPulseClosedTimer

protected Timer mPulseClosedTimer

mPulseThrownTimer

protected Timer mPulseThrownTimer

mPulseTimerOn

protected boolean mPulseTimerOn
Constructor Detail

SerialTurnout

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

'systemName' was previously validated in SerialTurnoutManager

Method Detail

forwardCommandChangeToLayout

protected void forwardCommandChangeToLayout(int newState)
Handle a request to change state by sending a turnout command

Specified by:
forwardCommandChangeToLayout in class AbstractTurnout
Parameters:
newState - desired new state, one of the Turnout class constants

canInvert

public boolean canInvert()
Turnouts do support inversion

Specified by:
canInvert in interface Turnout
Overrides:
canInvert in class AbstractTurnout

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.



Copyright © 1997 - 2011 JMRI Community.
JMRI, DecoderPro, PanelPro, SoundPro, DispatcherPro and associated logos are our trademarks.

Additional information on copyright, trademarks and licenses is linked here.
Site hosted by: Get JMRI Model Railroad Interface at SourceForge.net. Fast, secure and Free Open Source software downloads