Package jmri.implementation
Class DccSignalHead
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractSignalHead
-
- jmri.implementation.DccSignalHead
-
- All Implemented Interfaces:
java.beans.VetoableChangeListener
,java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,NamedBean
,Signal
,SignalHead
public class DccSignalHead extends AbstractSignalHead
This class implements a SignalHead that maps the various appearances values to aspect values in the Extended Accessory Decoder Control Packet Format and outputs that packet to the DCC System via the generic CommandStation interfaceThe mapping is as follows:
0 = RED
1 = YELLOW
2 = GREEN
3 = LUNAR
4 = FLASHRED
5 = FLASHYELLOW
6 = FLASHGREEN
7 = FLASHLUNAR
8 = DARK
The FLASH appearances are expected to be implemented in the decoder.
-
-
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 protected java.util.HashMap<java.lang.Integer,java.lang.Integer>
appearanceToOutput
-
Fields inherited from class jmri.implementation.AbstractSignalHead
mAppearance, mHeld, mLit
-
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.SignalHead
DARK, FLASHGREEN, FLASHLUNAR, FLASHRED, FLASHYELLOW, GREEN, HELD, LUNAR, RED, YELLOW
-
-
Constructor Summary
Constructors Constructor Description DccSignalHead(java.lang.String sys)
DccSignalHead(java.lang.String sys, java.lang.String user)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDccSignalHeadPacketSendCount()
Get the number of times the packet should be sent to the track.static int
getDefaultNumberForAppearance(int i)
int
getOutputForAppearance(int appearance)
boolean
isTurnoutUsed(Turnout t)
Check if a given turnout is used on this head.void
setAppearance(int newAppearance)
Set the Signal Head Appearance.void
setDccSignalHeadPacketSendCount(int count)
Set Number of times the packet should be sent to the track.void
setHeld(boolean newHeld)
Set the held parameter.void
setLit(boolean newLit)
void
setOutputForAppearance(int appearance, int number)
protected void
updateOutput()
boolean
useAddressOffSet()
void
useAddressOffSet(boolean boo)
-
Methods inherited from class jmri.implementation.AbstractSignalHead
getAppearance, getAppearanceKey, getAppearanceKey, getAppearanceName, getAppearanceName, getBeanType, getDefaultStateName, getDefaultValidStateNames, getDefaultValidStates, getHeld, getLit, getState, getValidStateKeys, getValidStateNames, getValidStates, isAtStop, isCleared, isShowingRestricting, setState, vetoableChange
-
Methods 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, 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, describeState, dispose, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
appearanceToOutput
protected java.util.HashMap<java.lang.Integer,java.lang.Integer> appearanceToOutput
-
-
Constructor Detail
-
DccSignalHead
public DccSignalHead(java.lang.String sys, java.lang.String user)
-
DccSignalHead
public DccSignalHead(java.lang.String sys)
-
-
Method Detail
-
setAppearance
public void setAppearance(int newAppearance)
Description copied from interface:SignalHead
Set the Signal Head Appearance.- Parameters:
newAppearance
- integer representing a valid Appearance for this head
-
setLit
public void setLit(boolean newLit)
Description copied from interface:SignalHead
-
setHeld
public void setHeld(boolean newHeld)
Set the held parameter.Note that this does not directly affect the output on the layout; the held parameter is a local variable which affects the aspect only via higher-level logic.
-
updateOutput
protected void updateOutput()
-
useAddressOffSet
public void useAddressOffSet(boolean boo)
-
useAddressOffSet
public boolean useAddressOffSet()
-
getOutputForAppearance
public int getOutputForAppearance(int appearance)
-
setOutputForAppearance
public void setOutputForAppearance(int appearance, int number)
-
getDefaultNumberForAppearance
public static int getDefaultNumberForAppearance(int i)
-
setDccSignalHeadPacketSendCount
public void setDccSignalHeadPacketSendCount(int count)
Set Number of times the packet should be sent to the track.- Parameters:
count
- - less than 1 is treated as 1
-
getDccSignalHeadPacketSendCount
public int getDccSignalHeadPacketSendCount()
Get the number of times the packet should be sent to the track.- Returns:
- the count
-
isTurnoutUsed
public boolean isTurnoutUsed(Turnout t)
Description copied from class:AbstractSignalHead
Check if a given turnout is used on this head.- Specified by:
isTurnoutUsed
in classAbstractSignalHead
- Parameters:
t
- Turnout object to check- Returns:
- true if turnout is configured as output or driver of head
-
-