Package jmri.jmrix.bidib
Class BiDiBLight
- java.lang.Object
-
- jmri.implementation.AbstractNamedBean
-
- jmri.implementation.AbstractLight
-
- jmri.implementation.AbstractVariableLight
-
- jmri.jmrix.bidib.BiDiBLight
-
- All Implemented Interfaces:
java.lang.Comparable<NamedBean>
,AnalogIO
,PropertyChangeProvider
,DigitalIO
,BiDiBNamedBeanInterface
,Light
,NamedBean
,VariableLight
public class BiDiBLight extends AbstractVariableLight implements BiDiBNamedBeanInterface
Implementation of the Light Control Object for BiDiB.
-
-
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 BiDiBOutputMessageHandler
messageHandler
-
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 BiDiBLight(java.lang.String systemName, BiDiBLightManager mgr)
Create a Light object from system name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Dispose of the light object.void
finishLoad()
Helper function that will be invoked after construction once the type has been set.BiDiBAddress
getAddr()
Get the BiDiB address instanceBiDiBAddress
getAddress()
Get addres object from a light objectBiDiBSystemConnectionMemo
getMemo()
Get connection memo from a light objectprotected int
getNumberOfSteps()
Provide the number of steps available between min and max intensityboolean
isIntensityVariable()
Check if this object can handle variable intensity.boolean
isTransitionAvailable()
Can the Light change its intensity setting slowly?void
nodeLost()
called then a node was lostvoid
nodeNew()
called then a new node has been discoveredvoid
receiveIntensity(int portstat)
Transfer incoming change event to JMRIprotected void
sendIntensity(double intensity)
Send a Dim/Bright commands to the hardware to reach a specific intensity.protected void
sendLcOutput(int portstat)
Send request to traffic controllerprotected void
sendOnOffCommand(int newState)
Send a On/Off Command to the hardwarevoid
setState(int newState)
Set the current state of this Light.void
setTargetIntensity(double intensity)
Set the intended new intensity value for the Light.-
Methods inherited from class jmri.implementation.AbstractVariableLight
describeState, getAbsoluteOrRelative, getCommandedAnalogValue, getCurrentIntensity, getMax, getMaxIntensity, getMin, getMinIntensity, getResolution, getState, getTargetIntensity, getTransitionTime, isTransitioning, newInternalMinute, notifyTargetIntensityChange, setCommandedAnalogValue, setMaxIntensity, setMinIntensity, setObservedAnalogValue, setState, 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, 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, getBeanType, getComment, getDisplayName, getDisplayName, getListenerRef, getListenerRefs, getNumPropertyChangeListeners, getProperty, getPropertyChangeListenersByReference, getPropertyKeys, 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
-
messageHandler
protected BiDiBOutputMessageHandler messageHandler
-
-
Constructor Detail
-
BiDiBLight
public BiDiBLight(java.lang.String systemName, BiDiBLightManager mgr)
Create a Light object from system name.- Parameters:
systemName
- System name of light to be createdmgr
- Light Manager, we get the memo object and the type letter (L) from the manager
-
-
Method Detail
-
getAddr
public BiDiBAddress getAddr()
Description copied from interface:BiDiBNamedBeanInterface
Get the BiDiB address instance- Specified by:
getAddr
in interfaceBiDiBNamedBeanInterface
- Returns:
- BiDiBAddress
-
finishLoad
public void finishLoad()
Helper function that will be invoked after construction once the type has been set. Used specifically for preventing double initialization when loading turnouts from XML.- Specified by:
finishLoad
in interfaceBiDiBNamedBeanInterface
-
nodeNew
public void nodeNew()
Description copied from interface:BiDiBNamedBeanInterface
called then a new node has been discovered- Specified by:
nodeNew
in interfaceBiDiBNamedBeanInterface
-
nodeLost
public void nodeLost()
Description copied from interface:BiDiBNamedBeanInterface
called then a node was lost- Specified by:
nodeLost
in interfaceBiDiBNamedBeanInterface
-
getMemo
public BiDiBSystemConnectionMemo getMemo()
Get connection memo from a light object- Returns:
- BiDiB connection memo instance
-
getAddress
public BiDiBAddress getAddress()
Get addres object from a light object- Returns:
- BiDiB address instance
-
dispose
public void dispose()
Dispose of the light object. Remove the Message Listener for this light object- Specified by:
dispose
in interfaceNamedBean
- Overrides:
dispose
in classAbstractNamedBean
-
isIntensityVariable
public boolean isIntensityVariable()
Check if this object can handle variable intensity.- Returns:
- true for some LC output types, false for others
-
isTransitionAvailable
public boolean isTransitionAvailable()
Can the Light change its intensity setting slowly?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. BiDiB LIGHTPORTs have internal dimming via port configuration.
Unbound property
- Specified by:
isTransitionAvailable
in interfaceVariableLight
- Overrides:
isTransitionAvailable
in classAbstractVariableLight
- Returns:
- true if isIntensityVariable() is true but for a LIGHTPORT return false.
-
setState
public void setState(int newState)
Set the current state of this Light. This routine requests the hardware to change.
-
setTargetIntensity
public void setTargetIntensity(double intensity)
Set the intended new intensity value for the Light. If transitions are in use, they will be applied.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.
- Specified by:
setTargetIntensity
in interfaceVariableLight
- Overrides:
setTargetIntensity
in classAbstractVariableLight
- Parameters:
intensity
- the desired brightness
-
sendLcOutput
protected void sendLcOutput(int portstat)
Send request to traffic controller- Parameters:
portstat
- BiDiB portstat value (see protocol description for valid values)
-
sendIntensity
protected void sendIntensity(double intensity)
Send a Dim/Bright commands to the hardware to reach a specific intensity.- Specified by:
sendIntensity
in classAbstractVariableLight
- Parameters:
intensity
- new intensity
-
receiveIntensity
public void receiveIntensity(int portstat)
Transfer incoming change event to JMRI- Parameters:
portstat
- BiDiB portstat value (see protocol description for valid values)
-
sendOnOffCommand
protected void sendOnOffCommand(int newState)
Description copied from class:AbstractVariableLight
Send a On/Off Command to the hardware- Specified by:
sendOnOffCommand
in classAbstractVariableLight
- Parameters:
newState
- new state
-
getNumberOfSteps
protected int getNumberOfSteps()
Description copied from class:AbstractVariableLight
Provide the number of steps available between min and max intensity- Specified by:
getNumberOfSteps
in classAbstractVariableLight
- Returns:
- number of steps
-
-