Class SE8cSignalHead
- All Implemented Interfaces:
VetoableChangeListener,Comparable<NamedBean>,EventListener,PropertyChangeProvider,NamedBean,Signal,SignalHead
This implementation writes out to the physical signal when it's commanded to change appearance, and updates its internal state when it hears commands from other places.
To get a complete set of aspects, we assume that the SE8C board has been configured such that the 4th aspect is "dark". We then do flashing aspects by commanding the lit appearance to change.
We can't assume any form of numbering for Turnouts to address the digits, so we take two turnout names as arguments. As a convenience, we manage the user names if they're not already set.
Only the DARK, RED, GREEN and YELLOW appearances will be properly tracked when they occur on the LocoNet. The FLASHING aspects won't be, nor will the Held or Lit states.
The algorithms in this class are a collaborative effort of Digitrax, Inc and 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
FieldsModifier and TypeFieldDescription(package private) NamedBeanHandle<Turnout>(package private) NamedBeanHandle<Turnout>Fields inherited from class jmri.implementation.DefaultSignalHead
delay, masterDelay, mFlashOn, timerFields inherited from class jmri.implementation.AbstractSignalHead
mAppearance, mHeld, mLitFields 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.Signal
PROPERTY_HELD, PROPERTY_LITFields inherited from interface jmri.SignalHead
DARK, FLASHGREEN, FLASHLUNAR, FLASHRED, FLASHYELLOW, GREEN, HELD, LUNAR, PROPERTY_APPEARANCE, RED, YELLOW -
Constructor Summary
ConstructorsConstructorDescriptionSE8cSignalHead(int pNumber) Compatibility ctorSE8cSignalHead(int pNumber, String userName) Compatibility ctor.SE8cSignalHead(String sname, NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO) Ctor specifying system name.SE8cSignalHead(String sname, NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO, String userName) Ctor specifying system name and user name.SE8cSignalHead(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO) Primary ctor without user name.SE8cSignalHead(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO, String userName) Primary ctor. -
Method Summary
Modifier and TypeMethodDescriptiongetHigh()getLow()(package private) voidinit()booleanCheck if a given turnout is used on this head.(package private) static NamedBeanHandle<Turnout>makeHandle(int i) Create a handle from a raw number.(package private) static StringmakeSystemName(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO) Implement convention for making a system name.protected voidType-specific routine to handle output to the layout hardware.Methods inherited from class jmri.implementation.DefaultSignalHead
appearanceSetsFlashTimer, getUsageReport, getValidStateKeys, getValidStateNames, getValidStates, setAppearance, setHeld, setLit, startFlash, stopFlashMethods inherited from class jmri.implementation.AbstractSignalHead
describeState, getAppearance, getAppearanceKey, getAppearanceKey, getAppearanceName, getAppearanceName, getBeanType, getDefaultStateName, getDefaultValidStateNames, getDefaultValidStates, getHeld, getLit, getState, isAtStop, isCleared, isShowingRestricting, setState, vetoableChangeMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, dispose, 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, dispose, 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, removePropertyChangeListener
-
Field Details
-
lowTurnout
-
highTurnout
-
-
Constructor Details
-
SE8cSignalHead
public SE8cSignalHead(NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO, String userName) Primary ctor.- Parameters:
lowTO- lower-numbered Turnout referencehighTO- higher-numbered Turnout referenceuserName- user name for mast
-
SE8cSignalHead
Primary ctor without user name.- Parameters:
lowTO- lower-numbered Turnout referencehighTO- higher-numbered Turnout reference
-
SE8cSignalHead
public SE8cSignalHead(String sname, NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO, String userName) Ctor specifying system name and user name.- Parameters:
sname- system name for mastlowTO- lower-numbered Turnout referencehighTO- higher-numbered Turnout referenceuserName- user name for mast
-
SE8cSignalHead
public SE8cSignalHead(String sname, NamedBeanHandle<Turnout> lowTO, NamedBeanHandle<Turnout> highTO) Ctor specifying system name.- Parameters:
sname- system name for mastlowTO- lower-numbered Turnout referencehighTO- higher-numbered Turnout reference
-
SE8cSignalHead
Compatibility ctor.- Parameters:
pNumber- number (address) of low turnoutuserName- name to use for this signal head
-
SE8cSignalHead
Compatibility ctor- Parameters:
pNumber- number (address) of low turnout
-
-
Method Details
-
makeSystemName
Implement convention for making a system name.Must pass arguments, as it is used before object is complete.
- Parameters:
lowTO- lower-numbered Turnout referencehighTO- higher-numbered Turnout reference- Returns:
- system name with fixed elements, i.e. IH:SE8c:to1\to2
-
makeHandle
Create a handle from a raw number.Static, so can be referenced before ctor complete.
- Parameters:
i- index number (address) of a turnout on the signal head- Returns:
- NamedBeanHandle<Turnout> object to use as output for head
- Throws:
IllegalArgumentException- when creation from i fails
-
init
void init() -
updateOutput
Type-specific routine to handle output to the layout hardware. Implemented to handle a request to change state by sending a LocoNet command.Does not notify listeners of changes; that's done elsewhere. Should consider the following variables to determine what to send:
- mAppearance
- mLit
- mFlashOn
- Specified by:
updateOutputin classDefaultSignalHead
-
getLow
-
getHigh
-
isTurnoutUsed
Description copied from class:AbstractSignalHeadCheck if a given turnout is used on this head.- Overrides:
isTurnoutUsedin classDefaultSignalHead- Parameters:
t- Turnout object to check- Returns:
- true if turnout is configured as output or driver of head
-