Package jmri.jmrix.marklin
Class MarklinTurnout
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractTurnout
-
- jmri.jmrix.marklin.MarklinTurnout
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,DigitalIO
,AbstractMRListener
,MarklinListener
,NamedBean
,Turnout
,VariableControlSpanBean
public class MarklinTurnout extends AbstractTurnout implements MarklinListener
Implement a Turnout via Marklin communications.This object doesn't listen to the Marklin 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.
Based on work by Bob Jacobsen
-
-
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 (package private) int
_number
(package private) static int
DCC
(package private) static int
METERINTERVAL
(package private) static int
MM2
(package private) java.lang.String
prefix
(package private) int
protocol
(package private) static int
PROTOCOL_UNKNOWN
(package private) static int
SFX
(package private) MarklinTrafficController
tc
-
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 MarklinTurnout(int number, java.lang.String prefix, MarklinTrafficController etc)
Marklin turnouts use the NMRA number (0-2040) as their numerical identification in the system name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canInvert()
Marklin turnouts can be invertedprotected void
forwardCommandChangeToLayout(int newState)
Handle a request to change state, typically by sending a message to the layout in some child class.(package private) int
getCANAddress()
void
message(MarklinMessage m)
void
reply(MarklinReply m)
protected void
sendMessage(boolean newstate)
Tell the layout to go to new state.protected void
sendOffMessage(int state)
(package private) void
setCommandedStateFromCS(int state)
Set the turnout known state to reflect what's been observed from the command station messages.(package private) void
setKnownStateFromCS(int state)
Set the turnout known state to reflect what's been observed from the command station messages.void
turnoutPushbuttonLockout(boolean b)
-
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, 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
-
prefix
java.lang.String prefix
-
_number
int _number
-
PROTOCOL_UNKNOWN
static final int PROTOCOL_UNKNOWN
- See Also:
- Constant Field Values
-
DCC
static final int DCC
- See Also:
- Constant Field Values
-
MM2
static final int MM2
- See Also:
- Constant Field Values
-
SFX
static final int SFX
- See Also:
- Constant Field Values
-
protocol
int protocol
-
METERINTERVAL
static final int METERINTERVAL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MarklinTurnout
public MarklinTurnout(int number, java.lang.String prefix, MarklinTrafficController etc)
Marklin turnouts use the NMRA number (0-2040) as their numerical identification in the system name.- Parameters:
number
- address of the turnoutprefix
- system prefixetc
- connection traffic controller
-
-
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
-
setCommandedStateFromCS
void setCommandedStateFromCS(int state)
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
void setKnownStateFromCS(int state)
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
-
turnoutPushbuttonLockout
public void turnoutPushbuttonLockout(boolean b)
- Specified by:
turnoutPushbuttonLockout
in classAbstractTurnout
-
canInvert
public boolean canInvert()
Marklin turnouts can be inverted- Specified by:
canInvert
in interfaceTurnout
- Overrides:
canInvert
in classAbstractTurnout
- Returns:
- invert supported
-
sendMessage
protected void sendMessage(boolean newstate)
Tell the layout to go to new state.- Parameters:
newstate
- State of the turnout to be sent to the command station
-
getCANAddress
int getCANAddress()
-
reply
public void reply(MarklinReply m)
- Specified by:
reply
in interfaceMarklinListener
-
message
public void message(MarklinMessage m)
- Specified by:
message
in interfaceMarklinListener
-
sendOffMessage
protected void sendOffMessage(int state)
-
-