com.sentilla.platform.tmote
Class Leds

java.lang.Object
  extended by com.sentilla.platform.tmote.Leds
All Implemented Interfaces:
Action, Leds

public class Leds
extends Object
implements Leds

Tmote implementation of Leds. The tmote has 3 leds that can represent binary values 0-7.


Field Summary
 
Fields inherited from interface com.sentilla.system.Action
DONE, ERROR, IDLE, PENDING
 
Constructor Summary
protected Leds()
           
 
Method Summary
 Action block()
          Block an indefinite amount of time until this Action is no longer pending.
 Action block(int timeoutMilli)
          Block a defined amount of time or until the Action is no longer pending.
 Action cancel()
          Cancel this Action if PENDING.
 byte getActionState()
          Get the current state of this Action: IDLE, PENDING, DONE, or ERROR.
 boolean isDone()
          Return true is this Action is DONE.
 void off(int value)
          Turns off selected LEDs.
 void on(int value)
          Turns on selected LEDs.
 void set(int value)
          Set all LED values.
 Leds setOff(int value)
          Asynchronous interface to turn off selected LEDs.
 Leds setOn(int value)
          Asynchronous interface to turn on selected LEDs.
 Leds setSet(int value)
          Asynchronous interface to set all LED values.
 Leds setToggle(int value)
          Asynchronous interface to toggle selected LEDs.
 Action submit()
          Submit this Action for processing by the action engine.
 void toggle(int value)
          Toggle selected LEDs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Leds

protected Leds()
Method Detail

set

public void set(int value)
Description copied from interface: Leds
Set all LED values.

Specified by:
set in interface Leds
Parameters:
value - a bit mask where true means on and false means off

on

public void on(int value)
Description copied from interface: Leds
Turns on selected LEDs.

Specified by:
on in interface Leds
Parameters:
value - a bit mask where true means on and false means ignore

off

public void off(int value)
Description copied from interface: Leds
Turns off selected LEDs.

Specified by:
off in interface Leds
Parameters:
value - a bit mask where true means off and false means ignore

toggle

public void toggle(int value)
Description copied from interface: Leds
Toggle selected LEDs.

Specified by:
toggle in interface Leds
Parameters:
value - a bit mask where true means toggle and false means ignore

setSet

public Leds setSet(int value)
Description copied from interface: Leds
Asynchronous interface to set all LED values.

Prepares the Action to set all LED values but does not initiate the operation until submit() is called.

Specified by:
setSet in interface Leds
Parameters:
value - a bit mask where true means on and false means off
Returns:
this, the Leds object that has been set to the specified state

setOn

public Leds setOn(int value)
Description copied from interface: Leds
Asynchronous interface to turn on selected LEDs.

Prepares the Action to turn on selected LEDs but does not initiate the operation until submit() is called.

Specified by:
setOn in interface Leds
Parameters:
value - a bit mask where true means on and false means ignore
Returns:
this, the Leds object that has been set to the specified state

setOff

public Leds setOff(int value)
Description copied from interface: Leds
Asynchronous interface to turn off selected LEDs.

Prepares the Action to turn off selected LEDs but does not initiate the operation until submit() is called.

Specified by:
setOff in interface Leds
Parameters:
value - a bit mask where true means off and false means ignore
Returns:
this, the Leds object that has been set to the specified state

setToggle

public Leds setToggle(int value)
Description copied from interface: Leds
Asynchronous interface to toggle selected LEDs.

Prepares the Action to toggle selected LEDs but does not initiate the operation until submit() is called.

Specified by:
setToggle in interface Leds
Parameters:
value - a bit mask where true means toggle and false means ignore
Returns:
this, the Leds object that has been set to the specified state

submit

public Action submit()
Description copied from interface: Action
Submit this Action for processing by the action engine. Calling submit transitions this Action to PENDING from either IDLE, DONE, or ERROR. Nothing happens if this Action is already PENDING.

Specified by:
submit in interface Action
Returns:
A pointer to this Action.

block

public Action block()
Description copied from interface: Action
Block an indefinite amount of time until this Action is no longer pending. Return immediately if the Action is IDLE or DONE. Return when the Action leaves the PENDING state, either through completion or cancellation. Throw ActionException if the Action is in ERROR.

Specified by:
block in interface Action
Returns:
A pointer to this Action.

block

public Action block(int timeoutMilli)
Description copied from interface: Action
Block a defined amount of time or until the Action is no longer pending. Return immediately if the Action is IDLE or DONE. Return when the Action leaves the PENDING state, either through completion or cancellation, or until the timeout occurs, whichever comes first. Throw ActionException is the Action is in ERROR.

Specified by:
block in interface Action
Parameters:
timeoutMilli - the maximum number of milliseconds to block
Returns:
A pointer to this Action.

cancel

public Action cancel()
Description copied from interface: Action
Cancel this Action if PENDING. If cancel successfully completes, it transitions this Action to IDLE from any state. If this Action is PENDING, a best effort is made to remove it from the underlying Action engine, and failing that, exception XXX-TODO is thrown.

Specified by:
cancel in interface Action
Returns:
A pointer to this Action.

getActionState

public byte getActionState()
Description copied from interface: Action
Get the current state of this Action: IDLE, PENDING, DONE, or ERROR.

Specified by:
getActionState in interface Action

isDone

public boolean isDone()
Description copied from interface: Action
Return true is this Action is DONE. isDone can be used with block(timeoutMilli) to determine if the Action has completed. Calling isDone is equivalent to getActionState() == Action.DONE. Throw ActionException is getActionState() == Action.ERROR.

Specified by:
isDone in interface Action


Copyright © 2007 Sentilla Corporation. All Rights Reserved.