Class SerialTurnout
- All Implemented Interfaces:
PropertyChangeListener,Comparable<NamedBean>,EventListener,PropertyChangeProvider,DigitalIO,NamedBean,Turnout,VariableControlSpanBean
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
FieldsModifier and TypeFieldDescriptionprotected Timerprotected Timerprotected booleanprotected int(package private) StringFields 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, thrFields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, registerFields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWNFields inherited from interface jmri.Turnout
CABLOCKOUT, CLOSED, DELAYED, DIRECT, EXACT, INDIRECT, LNALTERNATE, LOCKED, MONITORING, ONESENSOR, PROPERTY_COMMANDED_STATE, PROPERTY_DECODER_NAME, PROPERTY_FEEDBACK_MODE, PROPERTY_INVERTED, PROPERTY_LEADING_TURNOUT, PROPERTY_LOCKED, PROPERTY_REPORT_LOCKED, PROPERTY_TURNOUT_DIVERGING_SPEED, PROPERTY_TURNOUT_FEEDBACK_FIRST_SENSOR, PROPERTY_TURNOUT_FEEDBACK_SECOND_SENSOR, PROPERTY_TURNOUT_OPERATION_STATE, PROPERTY_TURNOUT_STRAIGHT_SPEED, PUSHBUTTONLOCKOUT, SIGNAL, THROWN, TWOSENSOR, UNLOCKED -
Constructor Summary
ConstructorsConstructorDescriptionSerialTurnout(String systemName, String userName, MapleSystemConnectionMemo memo) Create a Turnout object, with both system and user names.SerialTurnout(String systemName, MapleSystemConnectionMemo memo) Create a Turnout object, with only a system name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTurnouts do support inversion.protected voidforwardCommandChangeToLayout(int newState) Handle a request to change state, typically by sending a message to the layout in some child class.protected voidsendMessage(boolean closed) Control the actual layout hardware.protected voidturnoutPushbuttonLockout(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, vetoableChangeMethods 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, updateListenerRefMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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, updateListenerRefMethods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from interface jmri.Turnout
provideFeedbackSensor
-
Field Details
-
tSystemName
-
tBit
-
mPulseClosedTimer
-
mPulseThrownTimer
-
mPulseTimerOn
-
-
Constructor Details
-
SerialTurnout
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
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 Details
-
forwardCommandChangeToLayout
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:
forwardCommandChangeToLayoutin classAbstractTurnout- Parameters:
newState- new state value
-
canInvert
Turnouts do support inversion.- Specified by:
canInvertin interfaceTurnout- Overrides:
canInvertin classAbstractTurnout- Returns:
- invert supported
-
turnoutPushbuttonLockout
- Specified by:
turnoutPushbuttonLockoutin classAbstractTurnout
-
sendMessage
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
-