|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.spot.sensorboard.io.ScalarInput com.sun.spot.sensorboard.peripheral.TemperatureInput
public class TemperatureInput
Simple extension of ScalarInput.
Field Summary |
---|
Fields inherited from class com.sun.spot.sensorboard.io.ScalarInput |
---|
index, myController, range |
Fields inherited from interface com.sun.spot.sensorboard.peripheral.ITemperatureInput |
---|
CELSIUS, FAHRENHEIT |
Constructor Summary | |
---|---|
TemperatureInput(PinDescriptor pidx,
int r,
IADCController cntrl)
Creates a new instance of TemperatureInput |
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 toCelsius)
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 toCelsius)
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 toCelsius)
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 inCelsius)
Set the low and high threshold values for this temperature sensor. |
void |
thresholdChanged(int low,
int high)
Called by pin's IADCController when pin threshold values are changed. |
void |
thresholdExceeded(int val)
Callback from EDemoBoard interrupt handler for threshold event. |
Methods inherited from class com.sun.spot.sensorboard.io.ScalarInput |
---|
addIScalarInputThresholdListener, areThresholdEventsEnabled, enableThresholdEvents, getHighThreshold, getIndex, getIScalarInputThresholdListeners, getLowThreshold, getRange, getValue, getVoltage, removeIScalarInputThresholdListener, setThresholds, supportsThresholdEvents |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.sun.spot.sensorboard.io.IScalarInput |
---|
addIScalarInputThresholdListener, areThresholdEventsEnabled, enableThresholdEvents, getHighThreshold, getIndex, getIScalarInputThresholdListeners, getLowThreshold, getRange, getValue, removeIScalarInputThresholdListener, setThresholds, supportsThresholdEvents |
Constructor Detail |
---|
public TemperatureInput(PinDescriptor pidx, int r, IADCController cntrl)
pidx
- PinDescriptor that the temperature sensor is connected tor
- Range of the mask for the above pincntrl
- the ADC controller to useMethod Detail |
---|
public double convert(double val, boolean toCelsius)
convert
in interface ITemperatureInput
val
- value to converttoCelsius
- if true convert value from Fahrenheit to Celsius,
if false convert value from Celsius to Fahrenheit
public double getCelsius() throws IOException
getCelsius
in interface ITemperatureInput
IOException
public double getFahrenheit() throws IOException
getFahrenheit
in interface ITemperatureInput
IOException
public void setThresholds(double low, double high, boolean inCelsius)
setThresholds
in interface ITemperatureInput
low
- the new low threshold valuehigh
- the new high threshold valueinCelsius
- true if the new thresholds are in degrees Celsiuspublic void thresholdChanged(int low, int high)
thresholdChanged
in class ScalarInput
low
- the new low threshold value.high
- the new high threshold value.public double getLowThreshold(boolean toCelsius)
getLowThreshold
in interface ITemperatureInput
toCelsius
- if true report the low threshold in degrees Celsius
public double getHighThreshold(boolean toCelsius)
getHighThreshold
in interface ITemperatureInput
toCelsius
- if true report the high threshold in degrees Celsius
public void addITemperatureInputThresholdListener(ITemperatureInputThresholdListener who)
addITemperatureInputThresholdListener
in interface ITemperatureInput
who
- the temperature sensor threshold listener to add.public void removeITemperatureInputThresholdListener(ITemperatureInputThresholdListener who)
removeITemperatureInputThresholdListener
in interface ITemperatureInput
who
- the temperature sensor threshold listener to remove.public ITemperatureInputThresholdListener[] getITemperatureInputThresholdListeners()
getITemperatureInputThresholdListeners
in interface ITemperatureInput
public void thresholdExceeded(int val)
thresholdExceeded
in class ScalarInput
val
- temperature sensor value taken after event triggered
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |