Class SerialLight
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractLight
-
- jmri.implementation.AbstractVariableLight
-
- jmri.jmrix.powerline.SerialLight
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,AnalogIO
,PropertyChangeProvider
,DigitalIO
,Light
,NamedBean
,VariableLight
- Direct Known Subclasses:
SerialX10Light
,SpecificDmxLight
,SpecificInsteonLight
,SpecificInsteonLight
public abstract class SerialLight extends AbstractVariableLight
Implementation of the Light Object for Powerline devices.For X10 devices, uses dimming commands to set intensity unless the value is 0.0 or 1.0, in which case it uses on/off commands only.
For Insteon devices, uses direct setting of intensity level unless the value is 0.0 or 1.0, in which case it uses on/off commands only.
For DMX devices, use direct setting of the intensity level. But an on/off will skip any stepping of the change.
For X10, since the dim/bright step of the hardware is unknown then the Light object is first created, the first time the intensity (not state) is set to other than 0.0 or 1.0, the output is run to it's maximum dim or bright step so that we know the count is right.
For X10, keeps track of the controller's "dim count", and if not certain forces it to zero to be sure.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.AnalogIO
AnalogIO.AbsoluteOrRelative
-
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 int
devicecode
protected int
housecode
protected int
idhighbyte
protected int
idlowbyte
protected int
idmiddlebyte
(package private) SerialTrafficController
tc
protected int
unitid
-
Fields inherited from class jmri.implementation.AbstractVariableLight
alarmSyncUpdate, internalClock, minuteChangeListener, mLastTransitionDate, mNextTransitionTs, mTransitionDuration, mTransitionTargetIntensity
-
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 SerialLight(java.lang.String systemName, SerialTrafficController tc)
Create a Light object, with only system name.SerialLight(java.lang.String systemName, SerialTrafficController tc, 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 protected void
initializeLight()
Invoked from constructors to set up details.protected void
initIntensity(double intensity)
Optionally, force control to a known "dim count".protected void
sendOnOffCommand(int newState)
Send a On/Off Command to the hardware-
Methods inherited from class jmri.implementation.AbstractVariableLight
describeState, getAbsoluteOrRelative, getCommandedAnalogValue, getCurrentIntensity, getMax, getMaxIntensity, getMin, getMinIntensity, getNumberOfSteps, getResolution, getState, getTargetIntensity, getTransitionTime, isTransitionAvailable, isTransitioning, newInternalMinute, notifyTargetIntensityChange, sendIntensity, setCommandedAnalogValue, setMaxIntensity, setMinIntensity, setObservedAnalogValue, setState, setState, setTargetIntensity, setTransitionTime, startTransition
-
Methods inherited from class jmri.implementation.AbstractLight
activateLight, addLightControl, clearLightControls, deactivateLight, doNewState, getBeanType, getEnabled, getLightControlList, getState, getUsageReport, notifyStateChange, setEnabled
-
Methods inherited from class jmri.implementation.AbstractNamedBean
addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, 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, vetoableChange
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jmri.AnalogIO
getKnownAnalogValue
-
Methods inherited from interface jmri.Light
activateLight, addLightControl, clearLightControls, deactivateLight, getCommandedState, getEnabled, getKnownState, getLightControlList, getState, setCommandedState, setEnabled
-
Methods inherited from interface jmri.NamedBean
addPropertyChangeListener, addPropertyChangeListener, compareSystemNameSuffix, compareTo, dispose, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, getRecommendedToolTip, getSystemName, getUsageReport, getUserName, removeProperty, setComment, setProperty, setUserName, toString, updateListenerRef, vetoableChange
-
Methods inherited from interface jmri.beans.PropertyChangeProvider
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from interface jmri.VariableLight
isConsistentState, isConsistentValue, requestUpdateFromLayout
-
-
-
-
Field Detail
-
housecode
protected int housecode
-
devicecode
protected int devicecode
-
idhighbyte
protected int idhighbyte
-
idmiddlebyte
protected int idmiddlebyte
-
idlowbyte
protected int idlowbyte
-
unitid
protected int unitid
-
-
Constructor Detail
-
SerialLight
public SerialLight(java.lang.String systemName, SerialTrafficController tc)
Create a Light object, with only system name.'systemName' was previously validated in SerialLightManager
- Parameters:
systemName
- system name for lighttc
- traffic controller
-
SerialLight
public SerialLight(java.lang.String systemName, SerialTrafficController tc, java.lang.String userName)
Create a Light object, with both system and user names.'systemName' was previously validated in SerialLightManager
- Parameters:
systemName
- system name for lighttc
- traffic controlleruserName
- user name for light
-
-
Method Detail
-
initializeLight
protected void initializeLight()
Invoked from constructors to set up details. Note: most instance variables are in AbstractLight and AbstractVariableLight base classes.
-
initIntensity
protected void initIntensity(double intensity)
Optionally, force control to a known "dim count".Invoked the first time intensity is set.
Default implementation doesn't do anything.
- Parameters:
intensity
- float for 0->1.0
-
sendOnOffCommand
protected void sendOnOffCommand(int newState)
Send a On/Off Command to the hardware- Specified by:
sendOnOffCommand
in classAbstractVariableLight
- Parameters:
newState
- new state
-
-