SunSPOT API V5.0


com.sun.spot.sensorboard.peripheral
Interface ITemperatureInput

All Superinterfaces:
IScalarInput
All Known Implementing Classes:
TemperatureInput

public interface ITemperatureInput
extends IScalarInput

Simple extension of IScalarInput to handle temperature.


Field Summary
static boolean CELSIUS
           
static boolean FAHRENHEIT
           
 
Method Summary
 void addITemperatureInputThresholdListener(ITemperatureInputThresholdListener who)
          Adds the specified temperature sensor threshold listener to receive callbacks from this temperature sensor.
 double convert(double val, boolean celsius)
          Convert between Celsius and Fahrenheit.
 double getCelsius()
          Return the current temperature in degrees Celsius.
 double getFahrenheit()
          Return the current temperature in degrees Fahrenheit.
 double getHighThreshold(boolean celsius)
          Return the current high threshold value.
 ITemperatureInputThresholdListener[] getITemperatureInputThresholdListeners()
          Returns an array of all the temperature sensor threshold listeners registered on this temperature sensor.
 double getLowThreshold(boolean celsius)
          Return the current low threshold value.
 void removeITemperatureInputThresholdListener(ITemperatureInputThresholdListener who)
          Removes the specified temperature sensor threshold listener so that it no longer receives callbacks from this temperature sensor.
 void setThresholds(double low, double high, boolean celsius)
          Set the high and low thresholds for the temperature sensor.
 
Methods inherited from interface com.sun.spot.sensorboard.io.IScalarInput
addIScalarInputThresholdListener, areThresholdEventsEnabled, enableThresholdEvents, getHighThreshold, getIndex, getIScalarInputThresholdListeners, getLowThreshold, getRange, getValue, removeIScalarInputThresholdListener, setThresholds, supportsThresholdEvents
 

Field Detail

CELSIUS

static final boolean CELSIUS
See Also:
Constant Field Values

FAHRENHEIT

static final boolean FAHRENHEIT
See Also:
Constant Field Values
Method Detail

convert

double convert(double val,
               boolean celsius)
Convert between Celsius and Fahrenheit.

Parameters:
val - value to convert
celsius - if true convert value from Fahrenheit to Celsius, if false convert value from Celsius to Fahrenheit
Returns:
the input value converted to Celsius or Fahrenheit

getCelsius

double getCelsius()
                  throws IOException
Return the current temperature in degrees Celsius.

Returns:
the current temperature in degrees Celsius
Throws:
IOException

getFahrenheit

double getFahrenheit()
                     throws IOException
Return the current temperature in degrees Fahrenheit.

Returns:
the current temperature in degrees Fahrenheit
Throws:
IOException

setThresholds

void setThresholds(double low,
                   double high,
                   boolean celsius)
Set the high and low thresholds for the temperature sensor. Note: some devices, such as the internal thremometer in the ADT7411, only compare against the integer value.

Parameters:
low - the new low threshold value
high - the new high threshold value
celsius - true if the new thresholds are in degrees Celsius

getLowThreshold

double getLowThreshold(boolean celsius)
Return the current low threshold value.

Parameters:
celsius - if true report the low threshold in degrees Celsius
Returns:
the current low threshold value.

getHighThreshold

double getHighThreshold(boolean celsius)
Return the current high threshold value.

Parameters:
celsius - if true report the high threshold in degrees Celsius
Returns:
the current high threshold value.

addITemperatureInputThresholdListener

void addITemperatureInputThresholdListener(ITemperatureInputThresholdListener who)
Adds the specified temperature sensor threshold listener to receive callbacks from this temperature sensor. Callbacks occur when the temperature reading falls below or equal to the low threshold value, or when it rises above or equal to the high threshold value.

Parameters:
who - the temperature sensor threshold listener to add.

removeITemperatureInputThresholdListener

void removeITemperatureInputThresholdListener(ITemperatureInputThresholdListener who)
Removes the specified temperature sensor threshold listener so that it no longer receives callbacks from this temperature sensor. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this temperature sensor.

Parameters:
who - the temperature sensor threshold listener to remove.

getITemperatureInputThresholdListeners

ITemperatureInputThresholdListener[] getITemperatureInputThresholdListeners()
Returns an array of all the temperature sensor threshold listeners registered on this temperature sensor.

Returns:
all of this temperature sensor's ITemperatureInputThresholdListener or an empty array if no temperature sensor threshold listeners are currently registered.

SunSPOT API V5.0


Copyright � 2006-2008 Sun Microsystems, Inc. All Rights Reserved.