Package jmri.jmrix.nce
Class NceTurnout
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractTurnout
-
- jmri.jmrix.nce.NceTurnout
-
- All Implemented Interfaces:
java.beans.PropertyChangeListener
,java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,DigitalIO
,NamedBean
,Turnout
,VariableControlSpanBean
public class NceTurnout extends AbstractTurnout
Implement a Turnout via NCE communications.This object doesn't listen to the NCE 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
(package private) static java.lang.String[]
modeNames
(package private) static int[]
modeValues
(package private) java.lang.String
prefix
(package private) NceTrafficController
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 NceTurnout(NceTrafficController tc, java.lang.String p, int i)
NCE turnouts use the NMRA number (0-2044) as their numerical identification.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canInvert()
NCE turnouts can be inverted.boolean
canLock(int turnoutLockout)
NCE turnouts support two types of lockouts, pushbutton and cab.void
enableLockOperation(int turnoutLockout, boolean enabled)
Control which turnout locks are enabled.protected void
forwardCommandChangeToLayout(int newState)
Handle a request to change state, typically by sending a message to the layout in some child class.int
getNumber()
static int
getNumNtTurnouts()
int
getPossibleLockModes()
NCE turnouts can provide both modes when properly configured.protected void
sendMessage(boolean closed)
(package private) void
setCommandedStateFromCS(int state)
Set the turnout known state to reflect what's been observed from the command station polling.(package private) void
setKnownStateFromCS(int state)
Set the turnout known state to reflect what's been observed from the command station polling.protected void
turnoutPushbuttonLockout(boolean pushButtonLockout)
Send a message to the layout to lock or unlock the turnout pushbuttons if true, pushbutton lockout enabled.-
Methods inherited from class jmri.implementation.AbstractTurnout
describeState, dispose, forwardCommandChangeToLayout, getBeanType, getCommandedState, getControlType, getCurrentOperator, getDecoderName, getDivergingLimit, getDivergingSpeed, getFeedbackMode, getFeedbackModeForOperation, getFeedbackModeName, getFirstNamedSensor, getFirstSensor, getInhibitOperation, getInverted, getKnownState, getLeadingTurnout, getLocked, getNumberControlBits, 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
-
prefix
java.lang.String prefix
-
modeNames
static java.lang.String[] modeNames
-
modeValues
static int[] modeValues
-
_number
int _number
-
-
Constructor Detail
-
NceTurnout
public NceTurnout(NceTrafficController tc, java.lang.String p, int i)
NCE turnouts use the NMRA number (0-2044) as their numerical identification.- Parameters:
tc
- traffic controller for connectionp
- system connection prefixi
- NMRA turnout number
-
-
Method Detail
-
getNumber
public int getNumber()
-
getNumNtTurnouts
public static int getNumNtTurnouts()
-
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
-
turnoutPushbuttonLockout
protected void turnoutPushbuttonLockout(boolean pushButtonLockout)
Send a message to the layout to lock or unlock the turnout pushbuttons if true, pushbutton lockout enabled.- Specified by:
turnoutPushbuttonLockout
in classAbstractTurnout
-
setCommandedStateFromCS
void setCommandedStateFromCS(int state)
Set the turnout known state to reflect what's been observed from the command station polling. 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 polling. 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
-
canInvert
public boolean canInvert()
NCE turnouts can be inverted.- Specified by:
canInvert
in interfaceTurnout
- Overrides:
canInvert
in classAbstractTurnout
- Returns:
- invert supported
-
getPossibleLockModes
public int getPossibleLockModes()
NCE turnouts can provide both modes when properly configured.- Specified by:
getPossibleLockModes
in interfaceTurnout
- Overrides:
getPossibleLockModes
in classAbstractTurnout
- Returns:
- Both cab and pushbutton (decoder) modes
-
canLock
public boolean canLock(int turnoutLockout)
NCE turnouts support two types of lockouts, pushbutton and cab. Cab lockout requires the feedback mode to be Monitoring. This implementation by itself doesn't provide locking support. Override this in subclasses that do.- Specified by:
canLock
in interfaceTurnout
- Overrides:
canLock
in classAbstractTurnout
- Parameters:
turnoutLockout
- the type of lock, one of CABLOCKOUT, PUSHBUTTONLOCKOUT or BOTH = CABLOCKOUT | PUSHBUTTONLOCKOUT- Returns:
- false for not supported
-
enableLockOperation
public void enableLockOperation(int turnoutLockout, boolean enabled)
Control which turnout locks are enabled. Enable turnout lock operators. A turnout can be locked to prevent it being thrown from a cab or push button on the layout if supported by the protocol. Not implemented in AbstractTurnout.- Specified by:
enableLockOperation
in interfaceTurnout
- Overrides:
enableLockOperation
in classAbstractTurnout
- Parameters:
turnoutLockout
- the type of lockenabled
- true if locking is enabled for the given type; false otherwise
-
sendMessage
protected void sendMessage(boolean closed)
-
-