com.phidgets
Class TemperatureSensorPhidget

java.lang.Object
  extended by com.phidgets.Phidget
      extended by com.phidgets.TemperatureSensorPhidget

public final class TemperatureSensorPhidget
extends Phidget

This class represents a Phidget temperature Sensor. All methods to read temperaure data from the sensor are implemented in this class.

The Temperature Phidget consists of a thermocouple interface, and a temperature sensing IC, which is used to measure the temperature of the thermocouple cold junction and calibrate the thermocouple sensed temperature.

Both the thermocouple and temperature IC temperatures can be read. Value are returned in degrees celcius.


Constructor Summary
TemperatureSensorPhidget()
           
 
Method Summary
 void addTemperatureChangeListener(TemperatureChangeListener l)
          Adds a temperature change listener.
 int getSensorCount()
          Returns the number of temperature sensors.
 double getTemperature(int index)
          Returns the temperature of a input.
 double getTemperatureChangeTrigger(int index)
          Returns the change trigger for an input.
 void removeTemperatureChangeListener(TemperatureChangeListener l)
           
 void setTemperatureChangeTrigger(int index, double newVal)
          Sets the change trigger for an input.
 
Methods inherited from class com.phidgets.Phidget
addAttachListener, addDetachListener, addErrorListener, close, equals, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getTag, isAttached, open, openAny, removeAttachListener, removeDetachListener, removeErrorListener, setTag, toString, waitForAttachment
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TemperatureSensorPhidget

public TemperatureSensorPhidget()
                         throws PhidgetException
Throws:
PhidgetException
Method Detail

getSensorCount

public int getSensorCount()
                   throws PhidgetException
Returns the number of temperature sensors. Currently, this is 2, with input 0 being the cold junction IC and input 1 being the thermocouple.

Returns:
Number of inputs
Throws:
PhidgetException

getTemperature

public double getTemperature(int index)
                      throws PhidgetException
Returns the temperature of a input. This value is returned in degrees celcius but can easily be converted into other units. The accuracy depends on the thermocouple used. The board is calibrated during manufacture.

Parameters:
index - Index of the temperature sensor - 0 in the IC, 1 is the thermocouple
Returns:
Temperature in derees celcius
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

setTemperatureChangeTrigger

public void setTemperatureChangeTrigger(int index,
                                        double newVal)
                                 throws PhidgetException
Sets the change trigger for an input. This is the ammount by which the sensed temperature must change between TemperatureChangeEvents. By default this is set to 5.

Parameters:
index - Input
newVal - Trigger
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached.

getTemperatureChangeTrigger

public double getTemperatureChangeTrigger(int index)
                                   throws PhidgetException
Returns the change trigger for an input. This is the ammount by which the sensed temperature must change between TemperatureChangeEvents. By default this is set to 5.

Parameters:
index - Input
Returns:
Trigger
Throws:
PhidgetException - If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached.

addTemperatureChangeListener

public final void addTemperatureChangeListener(TemperatureChangeListener l)
Adds a temperature change listener. The temperature change handler is a method that will be called when the temperature has changed by at least the Trigger that has been set.

There is no limit on the number of weight change handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the TemperatureChangeListener interface

removeTemperatureChangeListener

public final void removeTemperatureChangeListener(TemperatureChangeListener l)