Class BiDiBLight

All Implemented Interfaces:
Comparable<NamedBean>, AnalogIO, PropertyChangeProvider, DigitalIO, BiDiBNamedBeanInterface, Light, NamedBean, VariableLight

Implementation of the Light Control Object for BiDiB.
  • Field Details

  • Constructor Details

    • BiDiBLight

      public BiDiBLight(String systemName, BiDiBLightManager mgr)
      Create a Light object from system name.
      Parameters:
      systemName - System name of light to be created
      mgr - Light Manager, we get the memo object and the type letter (L) from the manager
  • Method Details

    • getAddr

      Description copied from interface: BiDiBNamedBeanInterface
      Get the BiDiB address instance
      Specified by:
      getAddr in interface BiDiBNamedBeanInterface
      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 interface BiDiBNamedBeanInterface
    • nodeNew

      public void nodeNew()
      Description copied from interface: BiDiBNamedBeanInterface
      called then a new node has been discovered
      Specified by:
      nodeNew in interface BiDiBNamedBeanInterface
    • nodeLost

      public void nodeLost()
      Description copied from interface: BiDiBNamedBeanInterface
      called then a node was lost
      Specified by:
      nodeLost in interface BiDiBNamedBeanInterface
    • getMemo

      Get connection memo from a light object
      Returns:
      BiDiB connection memo instance
    • 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 interface NamedBean
      Overrides:
      dispose in class AbstractNamedBean
    • 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 interface VariableLight
      Overrides:
      isTransitionAvailable in class AbstractVariableLight
      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.
      Specified by:
      setState in interface Light
      Specified by:
      setState in interface NamedBean
      Overrides:
      setState in class AbstractVariableLight
      Parameters:
      newState - new requested state - must be ON or OFF
    • 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 interface VariableLight
      Overrides:
      setTargetIntensity in class AbstractVariableLight
      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 class AbstractVariableLight
      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 class AbstractVariableLight
      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 class AbstractVariableLight
      Returns:
      number of steps