Package jmri.jmrix.dccpp
Class DCCppLight
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractLight
-
- jmri.jmrix.dccpp.DCCppLight
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,java.util.EventListener
,PropertyChangeProvider
,DigitalIO
,AbstractMRListener
,DCCppListener
,Light
,NamedBean
public class DCCppLight extends AbstractLight implements DCCppListener
Implementation of the Light Object for DCC++NOTE: This is a simplification of the DCCppTurnout class.
Based in part on SerialLight.java
-
-
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) static int
COMMANDSENT
(package private) static int
IDLE
(package private) int
mAddress
System dependent instance variables(package private) static int
OFFSENT
-
Fields inherited from class jmri.implementation.AbstractLight
lightControlList, mActive, mCurrentIntensity, mEnabled, mMaxIntensity, mMinIntensity, mState
-
Fields inherited from class jmri.implementation.AbstractNamedBean
listenerRefs, mSystemName, register
-
Fields inherited from interface jmri.Light
FAST_CLOCK_CONTROL, INTERMEDIATE, NO_CONTROL, SENSOR_CONTROL, TIMED_ON_CONTROL, TRANSITIONING, TRANSITIONINGHIGHER, TRANSITIONINGLOWER, TRANSITIONINGTOFULLOFF, TRANSITIONINGTOFULLON, TURNOUT_STATUS_CONTROL, TWO_SENSOR_CONTROL
-
Fields inherited from interface jmri.NamedBean
DISPLAY_NAME_FORMAT, INCONSISTENT, PROPERTY_STATE, QUOTED_NAME_FORMAT, UNKNOWN
-
-
Constructor Summary
Constructors Constructor Description DCCppLight(DCCppTrafficController tc, DCCppLightManager lm, java.lang.String systemName)
Create a Light object, with only system name.DCCppLight(DCCppTrafficController tc, DCCppLightManager lm, java.lang.String systemName, java.lang.String userName)
Create a Light object, with both system and user names.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Dispose of the light object.void
message(DCCppMessage l)
Member function that will be invoked by a DCCppInterface implementation to forward a DCC++ message sent to the layout.void
message(DCCppReply l)
Member function that will be invoked by a DCCppInterface implementation to forward a DCC++ message from the layout.void
notifyTimeout(DCCppMessage msg)
Member function invoked by an DCCppInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.void
setState(int newState)
Set the current state of this Light.-
Methods inherited from class jmri.implementation.AbstractLight
activateLight, addLightControl, clearLightControls, deactivateLight, describeState, doNewState, getBeanType, getEnabled, getLightControlList, getState, getUsageReport, notifyStateChange, notifyTargetIntensityChange, setEnabled
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, 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, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.Light
getCommandedState, getKnownState, isConsistentState, requestUpdateFromLayout, setCommandedState
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getSystemName, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
-
-
-
Field Detail
-
mAddress
int mAddress
System dependent instance variables
-
OFFSENT
static final int OFFSENT
- See Also:
- Constant Field Values
-
COMMANDSENT
static final int COMMANDSENT
- See Also:
- Constant Field Values
-
IDLE
static final int IDLE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DCCppLight
public DCCppLight(DCCppTrafficController tc, DCCppLightManager lm, java.lang.String systemName)
Create a Light object, with only system name.'systemName' was previously validated in DCCppLightManager
- Parameters:
tc
- the traffic controller for the connectionlm
- the managing LightManager for this LightsystemName
- the system name for this Light
-
DCCppLight
public DCCppLight(DCCppTrafficController tc, DCCppLightManager lm, java.lang.String systemName, java.lang.String userName)
Create a Light object, with both system and user names.'systemName' was previously validated in DCCppLightManager
- Parameters:
tc
- the traffic controller for the connectionlm
- the managing LightManager for this LightsystemName
- the system name for this LightuserName
- the user name for this Light
-
-
Method Detail
-
dispose
public void dispose()
Dispose of the light object.- Specified by:
dispose
in interfaceNamedBean
- Overrides:
dispose
in classAbstractNamedBean
-
setState
public void setState(int newState)
Set the current state of this Light. This routine requests the hardware to change.
-
message
public void message(DCCppReply l)
Member function that will be invoked by a DCCppInterface implementation to forward a DCC++ message from the layout. Handle an incoming message from the DCC++ Base Station.NOTE: We aren't registered as a listener, so this is only triggered when we send out a message
- Specified by:
message
in interfaceDCCppListener
- Parameters:
l
- The received DCC++ message. Note that this same object may be presented to multiple users. It should not be modified here.
-
message
public void message(DCCppMessage l)
Member function that will be invoked by a DCCppInterface implementation to forward a DCC++ message sent to the layout. Normally, this function will do nothing. Listen for messages to the DCC++ Base Station.- Specified by:
message
in interfaceDCCppListener
- Parameters:
l
- The received DCC++ message. Note that this same object may be presented to multiple users. It should not be modified here.
-
notifyTimeout
public void notifyTimeout(DCCppMessage msg)
Description copied from interface:DCCppListener
Member function invoked by an DCCppInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.- Specified by:
notifyTimeout
in interfaceDCCppListener
- Parameters:
msg
- the message that timed out.
-
-