|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjmri.implementation.AbstractNamedBean
jmri.implementation.AbstractLight
jmri.implementation.AbstractVariableLight
public abstract class AbstractVariableLight
Abstract class providing partial implementation of the logic of the Light interface when the Intensity is variable.
Now it includes the transition code, but it only does the steps on the fast minute clock. Later it may do it's own timing but this was simple to piggy back on the fast minute listener.
The structure is in part dictated by the limitations of the X10 protocol and implementations. However, it is not limited to X10 devices only. Other interfaces that have a way to provide a dimmable light should use it. X10 has on/off commands, and separate commands for setting a variable intensity via "dim" commands. Some X10 implementations use relative dimming, some use absolute dimming. Some people set the dim level of their Lights and then just use on/off to turn control the lamps; in that case we don't want to send dim commands. Further, X10 communications is very slow, and sending a complete set of dim operations can take a long time. So the algorithm is:
Unlike the parent class, this stores CurrentIntensity and TargetIntensity in separate variables.
| Field Summary |
|---|
| Fields inherited from interface jmri.Light |
|---|
FAST_CLOCK_CONTROL, INTERMEDIATE, NO_CONTROL, OFF, ON, SENSOR_CONTROL, TIMED_ON_CONTROL, TRANSITIONING, TRANSITIONINGHIGHER, TRANSITIONINGLOWER, TRANSITIONINGTOFULLOFF, TRANSITIONINGTOFULLON, TURNOUT_STATUS_CONTROL, TWO_SENSOR_CONTROL |
| Fields inherited from interface jmri.NamedBean |
|---|
INCONSISTENT, UNKNOWN |
| Constructor Summary | |
|---|---|
AbstractVariableLight(String systemName)
|
|
AbstractVariableLight(String systemName,
String userName)
|
|
| Method Summary | |
|---|---|
double |
getTransitionTime()
Get the number of fastclock minutes taken by a transition from full ON to full OFF or vice versa. |
boolean |
isIntensityVariable()
Check if this object can handle variable intensity. |
boolean |
isTransitionAvailable()
Can the Light change it's intensity setting slowly? |
boolean |
isTransitioning()
Convenience method for checking if the intensity of the light is currently changing due to a transition. |
void |
setState(int newState)
Handle a request for a state change. |
void |
setTargetIntensity(double intensity)
Set the intended new intensity value for the Light. |
void |
setTransitionTime(double minutes)
Set the fast-clock duration for a transition from full ON to full OFF or vice-versa. |
| Methods inherited from class jmri.implementation.AbstractLight |
|---|
activateLight, addLightControl, clearLightControls, deactivateLight, getCurrentIntensity, getEnabled, getLightControlList, getMaxIntensity, getMinIntensity, getState, getTargetIntensity, setEnabled, setMaxIntensity, setMinIntensity |
| Methods inherited from class jmri.implementation.AbstractNamedBean |
|---|
addPropertyChangeListener, dispose, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getPropertyChangeListeners, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface jmri.NamedBean |
|---|
addPropertyChangeListener, dispose, getComment, getDisplayName, getNumPropertyChangeListeners, getProperty, getPropertyKeys, getSystemName, getUserName, removePropertyChangeListener, setComment, setProperty, setUserName |
| Constructor Detail |
|---|
public AbstractVariableLight(String systemName, String userName)
public AbstractVariableLight(String systemName)
| Method Detail |
|---|
public void setState(int newState)
ON and OFF avoid use of variable intensity if MaxIntensity = 1.0 or MinIntensity = 0.0, and no transition is being used.
public void setTargetIntensity(double intensity)
Bound property between 0 and 1.
A value of 0.0 corresponds to full off, and a value of 1.0 corresponds to full on.
Values at or below the minIntensity property will result in the Light going to the OFF state immediately. Values at or above the maxIntensity property will result in the Light going to the ON state immediately.
setTargetIntensity in interface LightsetTargetIntensity in class AbstractLightIllegalArgumentException - when intensity is less than 0.0 or more than 1.0public boolean isIntensityVariable()
isIntensityVariable in interface LightisIntensityVariable in class AbstractLightpublic boolean isTransitionAvailable()
If true, this Light supports a non-zero value of the transitionTime property, which controls how long the Light will take to change from one intensity level to another.
Unbound property
isTransitionAvailable in interface LightisTransitionAvailable in class AbstractLightpublic void setTransitionTime(double minutes)
Bound property
setTransitionTime in interface LightsetTransitionTime in class AbstractLightIllegalArgumentException - if minutes is not validpublic double getTransitionTime()
getTransitionTime in interface LightgetTransitionTime in class AbstractLightpublic boolean isTransitioning()
Bound property so that listeners can conveniently learn when the transition is over.
isTransitioning in interface LightisTransitioning in class AbstractLight
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||