com.sentilla.platform.tmote
Class Action

java.lang.Object
  extended by com.sentilla.platform.tmote.Action
All Implemented Interfaces:
Action
Direct Known Subclasses:
Adc, ByteReceiver, ByteSender, Cpu, CpuPowerSensor, DigitalPin, ExternUart, FlashFile, KernelProperty, MotePower

public class Action
extends Object
implements Action

Tmote implementation of the Action interface.


Field Summary
protected  byte actionAuto
           
protected  byte actionId
           
protected  byte actionState
           
protected  Isolate isolateOwner
           
 
Fields inherited from interface com.sentilla.system.Action
DONE, ERROR, IDLE, PENDING
 
Constructor Summary
protected Action()
           
 
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.
protected  void initAction(byte id)
           
 boolean isDone()
          Return true is this Action is DONE.
static int lookup(String action_name)
           
 Action submit()
          Submit this Action for processing by the action engine.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

actionId

protected byte actionId

actionState

protected byte actionState

actionAuto

protected byte actionAuto

isolateOwner

protected Isolate isolateOwner
Constructor Detail

Action

protected Action()
Method Detail

initAction

protected void initAction(byte id)

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()
             throws ActionException
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.
Throws:
ActionException

block

public Action block(int timeoutMilli)
             throws ActionException
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.
Throws:
ActionException

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()
               throws ActionException
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
Throws:
ActionException

lookup

public static int lookup(String action_name)


Copyright © 2007 Sentilla Corporation. All Rights Reserved.