com.sentilla.platform.tmote
Class SensirionSht11.Sht11Sensor<Q extends javax.measure.quantity.Quantity>

java.lang.Object
  extended by com.sentilla.platform.tmote.SensirionSht11.Sht11Sensor<Q>
All Implemented Interfaces:
Action, Sensor<Q>
Direct Known Subclasses:
SensirionSht11.HumSensor, SensirionSht11.TempSensor
Enclosing class:
SensirionSht11

protected abstract static class SensirionSht11.Sht11Sensor<Q extends javax.measure.quantity.Quantity>
extends Object
implements Sensor<Q>

Private: for Sentilla internal use only.


Field Summary
protected  javax.measure.Measurable<Q> result
           
 
Fields inherited from interface com.sentilla.system.Action
DONE, ERROR, IDLE, PENDING
 
Constructor Summary
protected SensirionSht11.Sht11Sensor()
           
 
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.
 javax.measure.Measurable<Q> getResult()
          Asynchronous interface to get the result of the last sensor read operation.
 boolean isDone()
          Return true is this Action is DONE.
 javax.measure.Measurable<Q> read()
          Read a new measurement and return the result.
 Sensor<Q> setRead()
          Asynchronous interface to set up a read operation on a sensor.
abstract  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

result

protected javax.measure.Measurable<Q extends javax.measure.quantity.Quantity> result
Constructor Detail

SensirionSht11.Sht11Sensor

protected SensirionSht11.Sht11Sensor()
Method Detail

submit

public abstract 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

read

public javax.measure.Measurable<Q> read()
Description copied from interface: Sensor
Read a new measurement and return the result.

After reading a sensor, be sure to read its value using Measureable.doubleValue(unit), where unit defines the resulting unit for the reading (such as SI.Celsius for a temperature reading).

Specified by:
read in interface Sensor<Q extends javax.measure.quantity.Quantity>
Returns:
Sensor measurement of type Q.

setRead

public Sensor<Q> setRead()
Description copied from interface: Sensor
Asynchronous interface to set up a read operation on a sensor. Use the submit() function to initiating the sensor reading.

Specified by:
setRead in interface Sensor<Q extends javax.measure.quantity.Quantity>
Returns:
The instance of Sensor that is set to read its sensor

getResult

public javax.measure.Measurable<Q> getResult()
Description copied from interface: Sensor
Asynchronous interface to get the result of the last sensor read operation.

Specified by:
getResult in interface Sensor<Q extends javax.measure.quantity.Quantity>
Returns:
Sensor measurement of type Q.


Copyright © 2007 Sentilla Corporation. All Rights Reserved.