sky.monome.behavior
Class LightOnPush

java.lang.Object
  extended by sky.monome.behavior.StaticBehavior
      extended by sky.monome.behavior.LightOnPush
All Implemented Interfaces:
Behavior

public class LightOnPush
extends StaticBehavior

Behavior that changes the led state accordingly to the button state, in a monostable manner.

Author:
PJ Skyman

Nested Class Summary
static class LightOnPush.LightOnPushType
          Type of behavior.
 
Field Summary
protected  LightOnPush.LightOnPushType pushAndLightType
          Type of behavior.
 
Fields inherited from class sky.monome.behavior.StaticBehavior
ledButtonCouple
 
Constructor Summary
LightOnPush()
          Constructs a "light on push" behavior with the default type LightOnPushType.PUSH_TO_LIGHT_ON.
LightOnPush(LightOnPush.LightOnPushType pushAndLightType)
          Constructs a "light on push" behavior with the specified type.
 
Method Summary
 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.StaticBehavior
getLedButtonCouple, setLedButtonCouple
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pushAndLightType

protected final LightOnPush.LightOnPushType pushAndLightType
Type of behavior.

Constructor Detail

LightOnPush

public LightOnPush()
Constructs a "light on push" behavior with the default type LightOnPushType.PUSH_TO_LIGHT_ON.


LightOnPush

public LightOnPush(LightOnPush.LightOnPushType pushAndLightType)
Constructs a "light on push" behavior with the specified type.

Parameters:
pushAndLightType - Type of behavior to adopt.
Method Detail

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 - When the led state can't be modified.

init

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