Class MarklinTurnout
- All Implemented Interfaces:
PropertyChangeListener,Comparable<NamedBean>,EventListener,PropertyChangeProvider,DigitalIO,AbstractMRListener,MarklinListener,NamedBean,Turnout,VariableControlSpanBean
This object doesn't listen to the Marklin communications for protocol auto-detection; protocol is determined at construction from the system name prefix. More than one Turnout object pointing to a single device is not allowed.
The system name encodes protocol and address:
MTDCC45— DCC accessory address 45, wire =DCCACCSTART + 44MTMM123— MM/MM2 accessory address 123, wire =MM1ACCSTART + 122MTCAN200— raw CAN wire address 200, used verbatimMT45— legacy unprefixed, treated as DCC
Based on work by Bob Jacobsen
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface jmri.NamedBean
NamedBean.BadNameException, NamedBean.BadSystemNameException, NamedBean.BadUserNameException, NamedBean.DisplayOptions, NamedBean.DuplicateSystemNameException -
Field Summary
FieldsFields 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, CS_VPIN, 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
ConstructorsConstructorDescriptionMarklinTurnout(String systemName, String prefix, MarklinTrafficController tc) Create a MarklinTurnout from its full system name. -
Method Summary
Modifier and TypeMethodDescriptionbooleanMarklin turnouts can be inverted.voiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.protected voidforwardCommandChangeToLayout(int newState) Handle a request to change state, typically by sending a message to the layout in some child class.(package private) intReturn the wire address for the accessory command.voidvoidprotected voidsendMessage(boolean newstate) protected voidsendOffMessage(int state) (package private) voidsetCommandedStateFromCS(int state) Set the turnout known state to reflect what's been observed from the command station messages.(package private) voidsetKnownStateFromCS(int state) Set the turnout known state to reflect what's been observed from the command station messages.voidturnoutPushbuttonLockout(boolean b) Methods inherited from class jmri.implementation.AbstractTurnout
canLock, describeState, 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, newKnownStateDelayed, 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, 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
-
METERINTERVAL
- See Also:
-
-
Constructor Details
-
MarklinTurnout
Create a MarklinTurnout from its full system name.- Parameters:
systemName- full system name, e.g.MTDCC45orMT123prefix- system prefix, e.g.Mtc- traffic controller
-
-
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
-
getCANAddress
int getCANAddress()Return the wire address for the accessory command.- DCC:
_number + DCCACCSTART - 1 - MM:
_number + MM1ACCSTART - 1 - CAN:
_numberverbatim (raw CAN address)
- DCC:
-
sendMessage
-
sendOffMessage
-
reply
- Specified by:
replyin interfaceMarklinListener
-
message
- Specified by:
messagein interfaceMarklinListener
-
turnoutPushbuttonLockout
- Specified by:
turnoutPushbuttonLockoutin classAbstractTurnout
-
canInvert
Marklin turnouts can be inverted.- Specified by:
canInvertin interfaceTurnout- Overrides:
canInvertin classAbstractTurnout- Returns:
- invert supported
-
setCommandedStateFromCS
Set the turnout known state to reflect what's been observed from the command station messages. 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
Set the turnout known state to reflect what's been observed from the command station messages. 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
-
dispose
Description copied from class:AbstractTurnoutDeactivate this object, so that it releases as many resources as possible and no longer effects others.For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.
It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.
Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained.
- Specified by:
disposein interfaceNamedBean- Overrides:
disposein classAbstractTurnout
-