sky.monome.behavior
Class BlinkingLight


java.lang.Object

  extended by sky.monome.behavior.DynamicBehavior

      extended by sky.monome.behavior.BlinkingLight

All Implemented Interfaces:
Behavior

public class BlinkingLight
extends DynamicBehavior

Behavior for blinking light. 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
BlinkingLight(long delay)
          Constructs a blinking light behavior with the specified delay.
BlinkingLight(java.lang.Long delay)
          Constructs a blinking light behavior with the 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

BlinkingLight


public BlinkingLight(long delay)
Constructs a blinking light behavior with the specified delay.

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

BlinkingLight


public BlinkingLight(java.lang.Long delay)
Constructs a blinking light behavior with the 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)
Notifies this behavior that an action on the button is performed. This method does nothing since the blinking effect is independent of button actions.

Parameters:
buttonAction - Button action that is performed.

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.