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 BiDiBOutputMessageHandlermessageHandler-
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, PROPERTY_TARGET_INTENSITY, 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_COMMENT, PROPERTY_ENABLED, PROPERTY_KNOWN_STATE, PROPERTY_STATE, PROPERTY_USERNAME, QUOTED_NAME_FORMAT, UNKNOWN
-
Fields inherited from interface jmri.VariableLight
PROPERTY_CURRENT_INTENSITY, PROPERTY_MAX_INTENSITY, PROPERTY_MIN_INTENSITY
-
-
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 voiddispose()Dispose of the light object.voidfinishLoad()Helper function that will be invoked after construction once the type has been set.BiDiBAddressgetAddr()Get the BiDiB address instanceBiDiBAddressgetAddress()Get addres object from a light objectBiDiBSystemConnectionMemogetMemo()Get connection memo from a light objectprotected intgetNumberOfSteps()Provide the number of steps available between min and max intensitybooleanisIntensityVariable()Check if this object can handle variable intensity.booleanisTransitionAvailable()Can the Light change its intensity setting slowly?voidnodeLost()called then a node was lostvoidnodeNew()called then a new node has been discoveredvoidreceiveIntensity(int portstat)Transfer incoming change event to JMRIprotected voidsendIntensity(double intensity)Send a Dim/Bright commands to the hardware to reach a specific intensity.protected voidsendLcOutput(int portstat)Send request to traffic controllerprotected voidsendOnOffCommand(int newState)Send a On/Off Command to the hardwarevoidsetState(int newState)Set the current state of this Light.voidsetTargetIntensity(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, 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
-
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:BiDiBNamedBeanInterfaceGet the BiDiB address instance- Specified by:
getAddrin 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:
finishLoadin interfaceBiDiBNamedBeanInterface
-
nodeNew
public void nodeNew()
Description copied from interface:BiDiBNamedBeanInterfacecalled then a new node has been discovered- Specified by:
nodeNewin interfaceBiDiBNamedBeanInterface
-
nodeLost
public void nodeLost()
Description copied from interface:BiDiBNamedBeanInterfacecalled then a node was lost- Specified by:
nodeLostin 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:
disposein interfaceNamedBean- Overrides:
disposein 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:
isTransitionAvailablein interfaceVariableLight- Overrides:
isTransitionAvailablein 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:
setTargetIntensityin interfaceVariableLight- Overrides:
setTargetIntensityin 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:
sendIntensityin 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:AbstractVariableLightSend a On/Off Command to the hardware- Specified by:
sendOnOffCommandin classAbstractVariableLight- Parameters:
newState- new state
-
getNumberOfSteps
protected int getNumberOfSteps()
Description copied from class:AbstractVariableLightProvide the number of steps available between min and max intensity- Specified by:
getNumberOfStepsin classAbstractVariableLight- Returns:
- number of steps
-
-