Package jmri.jmrix.openlcb
Class OlcbSignalMast
java.lang.Object
jmri.implementation.AbstractNamedBean
jmri.implementation.AbstractSignalMast
jmri.jmrix.openlcb.OlcbSignalMast
- All Implemented Interfaces:
VetoableChangeListener,Comparable<NamedBean>,EventListener,PropertyChangeProvider,NamedBean,Signal,SignalMast
This class implements a SignalMast that use OpenLCB Events
to set aspects.
This implementation writes out to the OpenLCB when it's commanded to change appearance, and updates its internal state when it hears Events from the network (including its own events).
System name specifies the creation information:
IF$dsm:basic:one-searchlight(123)The name is a colon-separated series of terms:
- I - system prefix
- F$olm - defines signal masts of this type
- basic - name of the signaling system
- one-searchlight - name of the particular aspect map
- ($123) - number distinguishing this from others
EventIDs are returned in format in which they were provided.
To keep OpenLCB distributed state consistent, setAspect(java.lang.String) does not immediately
change the local aspect. Instead, it produces the relevant EventId on the
network, waiting for that to return and do the local state change, notification, etc.
Needs to have held/unheld, lit/unlit state completed - those need to Produce and Consume events as above
Based upon DccSignalMast by Kevin Dickerson
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classImplement a general state machine where state transitions are associated with the production and consumption of specific events.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) OlcbSignalMast.StateMachine<String>(package private) Connection(package private) OlcbSignalMast.StateMachine<Boolean>protected static int(package private) OlcbSignalMast.StateMachine<Boolean>(package private) intprotected String(package private) NodeID(package private) CanSystemConnectionMemo(package private) StringFields inherited from class jmri.implementation.AbstractSignalMast
aspect, disabledAspects, map, speedFields 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.SignalMast
PROPERTY_ASPECT, PROPERTY_ASPECT_DISABLED, PROPERTY_ASPECT_ENABLED, PROPERTY_PERMISSIVE_SML_DISABLED -
Constructor Summary
ConstructorsConstructorDescriptionOlcbSignalMast(String sys) OlcbSignalMast(String sys, String user) OlcbSignalMast(String sys, String user, String mastSubType) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconfigureFromName(String systemName) booleangetHeld()"Held" property is just tracked and notified.static intProvide the last used sequence number of all OlcbSignalMasts in use.booleangetLit()Default behavior for "lit" property is to track value and return it.getOutputForAppearance(String appearance) voidhandleMessage(Message msg) Handle incoming messages.booleanisOutputConfigured(String appearance) voidSet aspect to a valid name in the current signal system definition.voidsetHeld(boolean newHeld) Always communicates via OpenLCBvoidsetHeldEventId(String event) protected static voidsetLastRef(int newVal) voidsetLit(boolean newLit) Always communicates via OpenLCBvoidsetLitEventId(String event) voidsetNotHeldEventId(String event) voidsetNotLitEventId(String event) voidsetOutputForAppearance(String appearance, String event) Methods inherited from class jmri.implementation.AbstractSignalMast
allowUnLit, configureAspectTable, configureSignalSystemDefinition, getAllKnownAspects, getAppearanceMap, getAspect, getBeanType, getDisabledAspects, getMastType, getSignalSystem, getSpeed, getState, getUsageReport, getValidAspects, isAspectDisabled, isAtStop, isCleared, isPermissiveSmlDisabled, isShowingRestricting, setAllowUnLit, setAspectDisabled, setAspectEnabled, setMastType, setPermissiveSmlDisabled, setState, vetoableChangeMethods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, 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, describeState, 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
-
mastType
-
litMachine
-
heldMachine
-
aspectMachine
-
node
-
connection
-
systemPrefix
-
systemMemo
-
mastNumber
int mastNumber -
lastRef
-
-
Constructor Details
-
OlcbSignalMast
-
OlcbSignalMast
-
OlcbSignalMast
-
-
Method Details
-
getSystemPrefix
-
configureFromName
-
setOutputForAppearance
-
isOutputConfigured
-
getOutputForAppearance
-
setAspect
Description copied from interface:SignalMastSet aspect to a valid name in the current signal system definition.- Specified by:
setAspectin interfaceSignalMast- Overrides:
setAspectin classAbstractSignalMast- Parameters:
aspect- the new aspect shown
-
handleMessage
Handle incoming messages.- Parameters:
msg- the message to handle.
-
setLit
Always communicates via OpenLCB- Specified by:
setLitin interfaceSignal- Specified by:
setLitin interfaceSignalMast- Overrides:
setLitin classAbstractSignalMast- Parameters:
newLit- the new value of lit
-
getLit
Description copied from class:AbstractSignalMastDefault behavior for "lit" property is to track value and return it.- Specified by:
getLitin interfaceSignal- Specified by:
getLitin interfaceSignalMast- Overrides:
getLitin classAbstractSignalMast- Returns:
- true if lit; false if dark
-
setHeld
Always communicates via OpenLCB- Specified by:
setHeldin interfaceSignal- Specified by:
setHeldin interfaceSignalMast- Overrides:
setHeldin classAbstractSignalMast- Parameters:
newHeld- the new value of the help property
-
getHeld
Description copied from class:AbstractSignalMast"Held" property is just tracked and notified.- Specified by:
getHeldin interfaceSignal- Specified by:
getHeldin interfaceSignalMast- Overrides:
getHeldin classAbstractSignalMast- Returns:
- true if held; false otherwise
-
setLastRef
- Parameters:
newVal- for ordinal of all OlcbSignalMasts in use
-
getLastRef
Provide the last used sequence number of all OlcbSignalMasts in use.- Returns:
- last used OlcbSignalMasts sequence number
-
setLitEventId
-
getLitEventId
-
setNotLitEventId
-
getNotLitEventId
-
setHeldEventId
-
getHeldEventId
-
setNotHeldEventId
-
getNotHeldEventId
-