com.qualcomm.robotcore.hardware

## Class LightBlinker

- java.lang.Object
- - com.qualcomm.robotcore.hardware.LightBlinker

- All Implemented Interfaces:
    Blinker

      public class LightBlinker
      extends java.lang.Object
      implements Blinker

  A `LightBlinker` is a handy utility that will flash a `SwitchableLight` in a pattern of timed durations, and, optionally, colors, if the light supports same (NYI)

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.qualcomm.robotcore.hardware.Blinker

      `Blinker.Step`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.ArrayList<Blinker.Step>` | `currentSteps`
    `protected java.util.concurrent.ScheduledFuture<?>` | `future`
    `protected SwitchableLight` | `light`
    `protected int` | `nextStep`
    `protected java.util.Deque<java.util.ArrayList<Blinker.Step>>` | `previousSteps`
    `static java.lang.String` | `TAG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LightBlinker(SwitchableLight light)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getBlinkerPatternMaxLength()` Returns the maximum number of `Blinker.Step`s that can be present in a pattern
    `java.util.Collection<Blinker.Step>` | `getPattern()` Returns the current blinking pattern
    `protected boolean` | `isCurrentPattern(java.util.Collection<Blinker.Step> steps)`
    `boolean` | `patternStackNotEmpty()` Returns whether the pattern stack is currently nonempty.
    `boolean` | `popPattern()` Pops the next pattern off of the stack of saved patterns, if any.
    `void` | `pushPattern(java.util.Collection<Blinker.Step> steps)` Saves the existing pattern such that it can be later restored, then calls setPattern().
    `protected void` | `scheduleNext()`
    `void` | `setConstant(int color)` Sets the blinker pattern to be a single, unchanging color
    `void` | `setPattern(java.util.Collection<Blinker.Step> steps)` Sets the pattern with which this LED or light should illuminate.
    `protected void` | `stop()`
    `void` | `stopBlinking()` Sets the blinker to constant black and frees any internal resources

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TAG

          public static final java.lang.String TAG

      See Also:
        Constant Field Values

    - #### light

          protected final SwitchableLight light

    - #### currentSteps

          protected java.util.ArrayList<Blinker.Step> currentSteps

    - #### previousSteps

          protected java.util.Deque<java.util.ArrayList<Blinker.Step>> previousSteps

    - #### future

          protected java.util.concurrent.ScheduledFuture<?> future

    - #### nextStep

          protected int nextStep

  - ### Constructor Detail

    - #### LightBlinker

          public LightBlinker(SwitchableLight light)

  - ### Method Detail

    - #### setConstant

          public void setConstant(int color)

      Description copied from interface: `Blinker`
      Sets the blinker pattern to be a single, unchanging color
      Specified by:
        `setConstant` in interface `Blinker`
      Parameters:
        `color` - the color with which the LED or light should be illuminated

    - #### stopBlinking

          public void stopBlinking()

      Description copied from interface: `Blinker`
      Sets the blinker to constant black and frees any internal resources
      Specified by:
        `stopBlinking` in interface `Blinker`

    - #### getBlinkerPatternMaxLength

          public int getBlinkerPatternMaxLength()

      Description copied from interface: `Blinker`
      Returns the maximum number of `Blinker.Step`s that can be present in a pattern
      Specified by:
        `getBlinkerPatternMaxLength` in interface `Blinker`
      Returns:
        the maximum number of `Blinker.Step`s that can be present in a pattern

    - #### pushPattern

          public void pushPattern(java.util.Collection<Blinker.Step> steps)

      Description copied from interface: `Blinker`
      Saves the existing pattern such that it can be later restored, then calls setPattern().
      Specified by:
        `pushPattern` in interface `Blinker`
      Parameters:
        `steps` - the new pattern to be displayed

    - #### patternStackNotEmpty

          public boolean patternStackNotEmpty()

      Description copied from interface: `Blinker`
      Returns whether the pattern stack is currently nonempty.
      Specified by:
        `patternStackNotEmpty` in interface `Blinker`
      Returns:
        whether the pattern stack is currently nonempty.

    - #### popPattern

          public boolean popPattern()

      Description copied from interface: `Blinker`
      Pops the next pattern off of the stack of saved patterns, if any. If the stack is empty, then this sets the blinker to a constant black.
      Specified by:
        `popPattern` in interface `Blinker`
      Returns:
        whether or not a pattern was removed from the stack (ie: whether the pattern stack was not empty prior to the call

    - #### setPattern

          public void setPattern(java.util.Collection<Blinker.Step> steps)

      Description copied from interface: `Blinker`
      Sets the pattern with which this LED or light should illuminate. If the list of steps is longer than the maximum number supported, then the pattern is truncated.
      Specified by:
        `setPattern` in interface `Blinker`
      Parameters:
        `steps` - the pattern of colors and durations that the LED or light should illuminate itself with

    - #### isCurrentPattern

          protected boolean isCurrentPattern(java.util.Collection<Blinker.Step> steps)

    - #### getPattern

          public java.util.Collection<Blinker.Step> getPattern()

      Description copied from interface: `Blinker`
      Returns the current blinking pattern
      Specified by:
        `getPattern` in interface `Blinker`
      Returns:
        the current blinking pattern

    - #### scheduleNext

          protected void scheduleNext()

    - #### stop

          protected void stop()