sky.monome.behavior
Class BlinkingLightOnPush

java.lang.Object
  extended by sky.monome.behavior.DynamicBehavior
      extended by sky.monome.behavior.BlinkingLightOnPush
All Implemented Interfaces:
Behavior

public class BlinkingLightOnPush
extends DynamicBehavior

Behavior for blinking light when the button is pushed. The blinking cadency is independent of any other blinking light behavior, so it should be unsynchronized. The blinking effect is permanent.

Author:
PJ Skyman

Nested Class Summary
 
Nested classes/interfaces inherited from class sky.monome.behavior.DynamicBehavior
DynamicBehavior.DynamicBehaviorType
 
Field Summary
protected  long delay
          Delay for one blinking cycle.
 
Fields inherited from class sky.monome.behavior.DynamicBehavior
dynamicBehaviorType, ledButtonCouple, thread
 
Constructor Summary
BlinkingLightOnPush(long delay)
          Constructs a blinking light on push behavior with te specified delay.
BlinkingLightOnPush(java.lang.Long delay)
          Constructs a blinking light on push behavior with te specified delay.
 
Method Summary
 void action()
          Invoked when the behavior must execute its perpetual or one-time action.
 void init()
          Initializes this behavior and the registered led/button couple.
 void notify(ButtonEvent.ButtonAction buttonAction)
          Notifies this behavior that an action on the button is performed.
 
Methods inherited from class sky.monome.behavior.DynamicBehavior
getLedButtonCouple, setLedButtonCouple, startThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delay

protected final long delay
Delay for one blinking cycle.

Constructor Detail

BlinkingLightOnPush

public BlinkingLightOnPush(long delay)
Constructs a blinking light on push behavior with te specified delay.

Parameters:
delay - Delay for one blinking cycle, in milliseconds.

BlinkingLightOnPush

public BlinkingLightOnPush(java.lang.Long delay)
Constructs a blinking light on push behavior with te specified delay.

Parameters:
delay - Delay for one blinking cycle, in milliseconds.
Since:
SkyMonome v1.2
Method Detail

action

public void action()
            throws java.lang.InterruptedException,
                   MonomeException
Invoked when the behavior must execute its perpetual or one-time action.

Specified by:
action in class DynamicBehavior
Throws:
java.lang.InterruptedException - When the virtual machine stops while a sleep operation.
MonomeException - When the led state of the registered led can't be modified.

notify

public void notify(ButtonEvent.ButtonAction buttonAction)
            throws MonomeException
Notifies this behavior that an action on the button is performed.

Parameters:
buttonAction - Button action that is performed.
Throws:
MonomeException - Only with a few behaviors, when a led state can't be modified, by example.

init

public void init()
Initializes this behavior and the registered led/button couple. It starts the internal thread. Only led/button couples should call this method, and should call it only one time.

Throws:
MonomeException - When the initialization of this behavior and the registered led/button couple was not possible.