Class BiDiBSignalMast
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractSignalMast
-
- jmri.jmrix.bidib.BiDiBSignalMast
-
- All Implemented Interfaces:
java.beans.VetoableChangeListener,java.lang.Comparable<NamedBean>,java.util.EventListener,PropertyChangeProvider,BiDiBNamedBeanInterface,NamedBean,Signal,SignalMast
public class BiDiBSignalMast extends AbstractSignalMast implements BiDiBNamedBeanInterface
This class implements a SignalMast that use BiDiB Accessories to set aspects.This implementation writes out to BiDiB when it's commanded to change appearance, and updates its internal state when it receives a status feedback from BiDiB.
System name specifies the creation information:
BF$bsm:basic:one-searchlight(123)
The name is a colon-separated series of terms:- B - system prefix
- F$bsm - defines signal masts of this type
- basic - name of the signaling system
- one-searchlight - name of the particular aspect map
- (node:123) - BiDiB Accessory address
To keep the state consistent,
setAspect(java.lang.String)does not immediately change the local aspect. Instead, it produces the relevant BiDiB message on the network, waiting for that to return and do the local state change, notification, etc.Based upon
DccSignalMastby Kevin Dickerson
-
-
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) BiDiBAddressaddrprotected java.util.HashMap<java.lang.String,java.lang.Integer>appearanceToOutput(package private) intcommandedAspectprotected java.lang.StringmastType(package private) BiDiBOutputMessageHandlermessageHandler(package private) BiDiBTrafficControllertc(package private) intunLitId-
Fields inherited from class jmri.implementation.AbstractSignalMast
aspect, disabledAspects, map, speed
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN
-
Fields inherited from interface jmri.Signal
PROPERTY_HELD, PROPERTY_LIT
-
Fields inherited from interface jmri.SignalMast
PROPERTY_ASPECT, PROPERTY_ASPECT_DISABLED, PROPERTY_ASPECT_ENABLED, PROPERTY_PERMISSIVE_SML_DISABLED
-
-
Constructor Summary
Constructors Constructor Description BiDiBSignalMast(java.lang.String sys)BiDiBSignalMast(java.lang.String sys, java.lang.String user)BiDiBSignalMast(java.lang.String sys, java.lang.String user, java.lang.String mastSubType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Deactivate this object, so that it releases as many resources as possible and no longer effects others.java.lang.StringgetAccessoryAddress()BiDiBAddressgetAddr()Get the BiDiB address instancestatic java.lang.StringgetNamePrefix()intgetOutputForAppearance(java.lang.String appearance)BiDiBTrafficControllergetTrafficController()intgetUnlitId()static java.lang.StringisAccessoryAddressUsed(BiDiBAddress address)voidnodeLost()called then a node was lostvoidnodeNew()called then a new node has been discoveredvoidqueryAccessory()Request the state of the accessory from the layout.protected voidsendMessage(int aspect)Send a accessory message to BiDiBvoidsetAspect(java.lang.String aspect)Set aspect to a valid name in the current signal system definition.voidsetLit(boolean newLit)Set the lit property.voidsetOutputForAppearance(java.lang.String appearance, int number)voidsetUnlitId(int i)-
Methods inherited from class jmri.implementation.AbstractSignalMast
allowUnLit, configureAspectTable, configureSignalSystemDefinition, getAllKnownAspects, getAppearanceMap, getAspect, getBeanType, getDisabledAspects, getHeld, getLit, getMastType, getSignalSystem, getSpeed, getState, getUsageReport, getValidAspects, isAspectDisabled, isAtStop, isCleared, isPermissiveSmlDisabled, isShowingRestricting, setAllowUnLit, setAspectDisabled, setAspectEnabled, setHeld, setMastType, setPermissiveSmlDisabled, setState, vetoableChange
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, describeState, 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.jmrix.bidib.BiDiBNamedBeanInterface
finishLoad
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, describeState, 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
-
-
-
-
Field Detail
-
messageHandler
BiDiBOutputMessageHandler messageHandler
-
addr
BiDiBAddress addr
-
commandedAspect
int commandedAspect
-
mastType
protected java.lang.String mastType
-
appearanceToOutput
protected java.util.HashMap<java.lang.String,java.lang.Integer> appearanceToOutput
-
unLitId
int unLitId
-
-
Constructor Detail
-
BiDiBSignalMast
public BiDiBSignalMast(java.lang.String sys, java.lang.String user)
-
BiDiBSignalMast
public BiDiBSignalMast(java.lang.String sys)
-
BiDiBSignalMast
public BiDiBSignalMast(java.lang.String sys, java.lang.String user, java.lang.String mastSubType)
-
-
Method Detail
-
getNamePrefix
public static java.lang.String getNamePrefix()
-
setOutputForAppearance
public void setOutputForAppearance(java.lang.String appearance, int number)
-
getOutputForAppearance
public int getOutputForAppearance(java.lang.String appearance)
-
setAspect
public void setAspect(@Nonnull java.lang.String aspect)
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
-
setLit
public void setLit(boolean newLit)
Description copied from class:AbstractSignalMastSet the lit property.This acts on all the SignalHeads included in this SignalMast
- Specified by:
setLitin interfaceSignal- Specified by:
setLitin interfaceSignalMast- Overrides:
setLitin classAbstractSignalMast- Parameters:
newLit- the new value of lit
-
queryAccessory
public void queryAccessory()
Request the state of the accessory from the layout. The listener gets the answer.
-
sendMessage
protected void sendMessage(int aspect)
Send a accessory message to BiDiB- Parameters:
aspect- to send
-
setUnlitId
public void setUnlitId(int i)
-
getUnlitId
public int getUnlitId()
-
getAccessoryAddress
public java.lang.String getAccessoryAddress()
-
getTrafficController
public BiDiBTrafficController getTrafficController()
-
getAddr
public BiDiBAddress getAddr()
Get the BiDiB address instance- Specified by:
getAddrin interfaceBiDiBNamedBeanInterface- Returns:
- BiDiBAddress
-
nodeNew
public void nodeNew()
called then a new node has been discovered- Specified by:
nodeNewin interfaceBiDiBNamedBeanInterface
-
nodeLost
public void nodeLost()
called then a node was lost- Specified by:
nodeLostin interfaceBiDiBNamedBeanInterface
-
dispose
public void dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others.For example, if this object has listeners, after a call to this method it should no longer notify those listeners. Any native or system-wide resources it maintains should be released, including threads, files, etc.
It is an error to invoke any other methods on this object once dispose() has been called. Note, however, that there is no guarantee about behavior in that case.
Afterwards, references to this object may still exist elsewhere, preventing its garbage collection. But it's formally dead, and shouldn't be keeping any other objects alive. Therefore, this method should null out any references to other objects that this NamedBean contained. Remove the Message Listener for this signal mast
- Specified by:
disposein interfaceNamedBean- Overrides:
disposein classAbstractNamedBean
-
isAccessoryAddressUsed
public static java.lang.String isAccessoryAddressUsed(BiDiBAddress address)
-
-