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
DccSignalMast
by 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) BiDiBAddress
addr
protected java.util.HashMap<java.lang.String,java.lang.Integer>
appearanceToOutput
(package private) int
commandedAspect
protected java.lang.String
mastType
(package private) BiDiBOutputMessageHandler
messageHandler
(package private) BiDiBTrafficController
tc
(package private) int
unLitId
-
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_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
-
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 void
dispose()
Deactivate this object, so that it releases as many resources as possible and no longer effects others.java.lang.String
getAccessoryAddress()
BiDiBAddress
getAddr()
Get the BiDiB address instancestatic java.lang.String
getNamePrefix()
int
getOutputForAppearance(java.lang.String appearance)
BiDiBTrafficController
getTrafficController()
int
getUnlitId()
static java.lang.String
isAccessoryAddressUsed(BiDiBAddress address)
void
nodeLost()
called then a node was lostvoid
nodeNew()
called then a new node has been discoveredvoid
queryAccessory()
Request the state of the accessory from the layout.protected void
sendMessage(int aspect)
Send a accessory message to BiDiBvoid
setAspect(java.lang.String aspect)
Set aspect to a valid name in the current signal system definition.void
setLit(boolean newLit)
Set the lit property.void
setOutputForAppearance(java.lang.String appearance, int number)
void
setUnlitId(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, 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:SignalMast
Set aspect to a valid name in the current signal system definition.- Specified by:
setAspect
in interfaceSignalMast
- Overrides:
setAspect
in classAbstractSignalMast
- Parameters:
aspect
- the new aspect shown
-
setLit
public void setLit(boolean newLit)
Description copied from class:AbstractSignalMast
Set the lit property.This acts on all the SignalHeads included in this SignalMast
- Specified by:
setLit
in interfaceSignal
- Specified by:
setLit
in interfaceSignalMast
- Overrides:
setLit
in 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:
getAddr
in interfaceBiDiBNamedBeanInterface
- Returns:
- BiDiBAddress
-
nodeNew
public void nodeNew()
called then a new node has been discovered- Specified by:
nodeNew
in interfaceBiDiBNamedBeanInterface
-
nodeLost
public void nodeLost()
called then a node was lost- Specified by:
nodeLost
in 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:
dispose
in interfaceNamedBean
- Overrides:
dispose
in classAbstractNamedBean
-
isAccessoryAddressUsed
public static java.lang.String isAccessoryAddressUsed(BiDiBAddress address)
-
-