Class SerialTurnout
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractTurnout
-
- jmri.jmrix.maple.SerialTurnout
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.lang.Comparable<NamedBean>
,java.util.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.swing.Timer
mPulseClosedTimer
protected javax.swing.Timer
mPulseThrownTimer
protected boolean
mPulseTimerOn
protected int
tBit
(package private) java.lang.String
tSystemName
-
Fields inherited from class jmri.implementation.AbstractTurnout
_activeFeedbackType, _cabLockout, _decoderName, _enableCabLockout, _enablePushButtonLockout, _inverted, _pushButtonLockout, _reportLocked, _validDecoderNames, _validFeedbackModes, _validFeedbackNames, _validFeedbackTypes, binaryOutput, DELAYED_FEEDBACK_INTERVAL, inhibitOperation, myOperator, myTurnoutOperation, r, thr
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
Fields inherited from interface jmri.Turnout
CABLOCKOUT, CLOSED, DELAYED, DIRECT, EXACT, INDIRECT, LNALTERNATE, LOCKED, MONITORING, ONESENSOR, PUSHBUTTONLOCKOUT, SIGNAL, THROWN, TWOSENSOR, UNLOCKED
-
-
Constructor Summary
Constructors Constructor Description SerialTurnout(java.lang.String systemName, java.lang.String userName, MapleSystemConnectionMemo memo)
Create a Turnout object, with both system and user names.SerialTurnout(java.lang.String systemName, MapleSystemConnectionMemo memo)
Create a Turnout object, with only a system name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canInvert()
Turnouts do support inversion.protected void
forwardCommandChangeToLayout(int newState)
Handle a request to change state, typically by sending a message to the layout in some child class.protected void
sendMessage(boolean closed)
Control the actual layout hardware.protected void
turnoutPushbuttonLockout(boolean _pushButtonLockout)
-
Methods inherited from class jmri.implementation.AbstractTurnout
canLock, describeState, dispose, enableLockOperation, forwardCommandChangeToLayout, getBeanType, getCommandedState, getControlType, getCurrentOperator, getDecoderName, getDivergingLimit, getDivergingSpeed, getFeedbackMode, getFeedbackModeForOperation, getFeedbackModeName, getFirstNamedSensor, getFirstSensor, getInhibitOperation, getInverted, getKnownState, getLeadingTurnout, getLocked, getNumberControlBits, getPossibleLockModes, getReportLocked, getSecondNamedSensor, getSecondSensor, getState, getStraightLimit, getStraightSpeed, getTurnoutOperation, getTurnoutOperator, getUsageReport, getValidDecoderNames, getValidFeedbackModes, getValidFeedbackNames, getValidFeedbackTypes, isCanFollow, isConsistentState, isFollowingCommandedState, leadingTurnoutPropertyChange, newCommandedState, newKnownState, operationPropertyChange, propertyChange, provideFirstFeedbackNamedSensor, provideFirstFeedbackSensor, provideSecondFeedbackNamedSensor, provideSecondFeedbackSensor, requestUpdateFromLayout, sensorPropertyChange, setBinaryOutput, setCommandedState, setCommandedStateAtInterval, setControlType, setDecoderName, setDivergingSpeed, setFeedbackMode, setFeedbackMode, setFollowingCommandedState, setInhibitOperation, setInitialKnownStateFromFeedback, setInverted, setLeadingTurnout, setLeadingTurnout, setLocked, setNumberControlBits, setReportLocked, setState, setStraightSpeed, setTurnoutOperation, stateChangeCheck, statesOk, turnoutPushbuttonLockout, vetoableChange
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, equals, firePropertyChange, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyChangeListeners, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, hashCode, removeProperty, removePropertyChangeListener, removePropertyChangeListener, setComment, setProperty, setUserName, toString, toStringSuffix, updateListenerRef
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface jmri.Turnout
provideFeedbackSensor
-
-
-
-
Field Detail
-
tSystemName
java.lang.String tSystemName
-
tBit
protected int tBit
-
mPulseClosedTimer
protected javax.swing.Timer mPulseClosedTimer
-
mPulseThrownTimer
protected javax.swing.Timer mPulseThrownTimer
-
mPulseTimerOn
protected boolean mPulseTimerOn
-
-
Constructor Detail
-
SerialTurnout
public SerialTurnout(java.lang.String systemName, java.lang.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 TurnoutuserName
- the user name for this Turnoutmemo
- the memo for the system connection
-
SerialTurnout
public SerialTurnout(java.lang.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 Turnoutmemo
- the memo for the system connection
-
-
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 classAbstractTurnout
- Parameters:
newState
- new state value
-
canInvert
public boolean canInvert()
Turnouts do support inversion.- Specified by:
canInvert
in interfaceTurnout
- Overrides:
canInvert
in classAbstractTurnout
- Returns:
- invert supported
-
turnoutPushbuttonLockout
protected void turnoutPushbuttonLockout(boolean _pushButtonLockout)
- Specified by:
turnoutPushbuttonLockout
in classAbstractTurnout
-
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
-
-