Package jmri.jmrix.ecos
Class EcosTurnout
java.lang.Object
jmri.implementation.AbstractNamedBean
jmri.implementation.AbstractTurnout
jmri.jmrix.ecos.EcosTurnout
- All Implemented Interfaces:
PropertyChangeListener
,Comparable<NamedBean>
,EventListener
,PropertyChangeProvider
,DigitalIO
,AbstractMRListener
,EcosListener
,NamedBean
,Turnout
public class EcosTurnout extends AbstractTurnout implements EcosListener
Implement a Turnout via ECoS communications.
This object doesn't listen to the Ecos 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.
-
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
static int
DOUBLESLIP
(package private) int
extended
(package private) boolean
masterObjectNumber
(package private) static String[]
modeNames
(package private) static int[]
modeValues
(package private) int
newstate
(package private) int
newstateext
(package private) int
objectNumber
(package private) String
prefix
(package private) String
slaveAddress
(package private) EcosTrafficController
tc
static int
THREEWAY
(package private) EcosTurnoutManager
tm
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, LOCKED, MONITORING, ONESENSOR, PUSHBUTTONLOCKOUT, SIGNAL, THROWN, TWOSENSOR, UNLOCKED
-
Constructor Summary
Constructors Constructor Description EcosTurnout(int number, String prefix, EcosTrafficController etc, EcosTurnoutManager etm)
ECoS turnouts use the NMRA number (0-2044) as their numerical identification in the system name. -
Method Summary
Modifier and Type Method Description boolean
canInvert()
Determine if the turnouts can be inverted.protected void
forwardCommandChangeToLayout(int newState)
Handle a request to change state, typically by sending a message to the layout in some child class.int
getExtended()
int
getNumber()
int
getObject()
String
getSlaveAddress()
void
message(EcosMessage m)
void
reply(EcosReply m)
protected void
sendMessage(boolean closed)
Tell the layout to go to new 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
setExtended(int e)
(package private) void
setKnownStateFromCS(int state)
Set the turnout known state to reflect what's been observed from the command station messages.(package private) void
setMasterObjectNumber(boolean o)
(package private) void
setObjectNumber(int o)
(package private) void
setSlaveAddress(int o)
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, getNumberOutputBits, 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, setNumberOutputBits, 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, getFullyFormattedDisplayName, getFullyFormattedDisplayName, 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, getFullyFormattedDisplayName, getFullyFormattedDisplayName, 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
-
Field Details
-
prefix
-
objectNumber
int objectNumber -
masterObjectNumber
boolean masterObjectNumber -
slaveAddress
-
extended
int extended -
modeNames
-
modeValues
-
tc
-
tm
-
THREEWAY
- See Also:
- Constant Field Values
-
DOUBLESLIP
- See Also:
- Constant Field Values
-
_number
int _number -
newstate
int newstate -
newstateext
int newstateext
-
-
Constructor Details
-
EcosTurnout
ECoS turnouts use the NMRA number (0-2044) as their numerical identification in the system name.- Parameters:
number
- DCC address of the turnoutprefix
- system prefixetc
- system connection traffic controlleretm
- ecos turnout manager
-
-
Method Details
-
setExtended
-
setObjectNumber
-
setSlaveAddress
-
setMasterObjectNumber
-
getNumber
-
getObject
-
getExtended
-
getSlaveAddress
-
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:
forwardCommandChangeToLayout
in classAbstractTurnout
- Parameters:
newState
- new state value
-
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
-
turnoutPushbuttonLockout
- Specified by:
turnoutPushbuttonLockout
in classAbstractTurnout
-
canInvert
Description copied from class:AbstractTurnout
Determine if the turnouts can be inverted. If true, inverted turnouts are supported.- Specified by:
canInvert
in interfaceTurnout
- Overrides:
canInvert
in classAbstractTurnout
- Returns:
- ECoS turnouts can be inverted
-
sendMessage
Tell the layout to go to new state.- Parameters:
closed
- State of the turnout to be sent to the command station
-
reply
- Specified by:
reply
in interfaceEcosListener
-
message
- Specified by:
message
in interfaceEcosListener
-