context.arch.generator
Class TemperatureSensor

java.lang.Object
  |
  +--context.arch.generator.TemperatureSensor

public class TemperatureSensor
extends java.lang.Object

This class acts as a wrapper around a temperature sensor. Whenever the temperature sensor changes by more than 0.5 degrees, the temperature, the units, and the timestamp are stored and made available to the context-aware infrastructure for polling, and can notify context widgets when data changes.

See Also:
Widget

Field Summary
static double THRESHOLD
          Change in temperature threshold
 
Constructor Summary
TemperatureSensor(Widget widget)
          Constructor that allows this object to read data from the serial port to which the temperature sensor is connected.
 
Method Summary
 javax.comm.SerialPort configPort(int baudRate, int databits, int stopbits, int parity)
          Method that configures the serial port
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

THRESHOLD

public static final double THRESHOLD
Change in temperature threshold
Constructor Detail

TemperatureSensor

public TemperatureSensor(Widget widget)
Constructor that allows this object to read data from the serial port to which the temperature sensor is connected. It sets the context widget to notify when there's a temperature change greater than THRESHOLD
Parameters:
widget - Widget to notify when the temperature changes greater than THRESHOLD
Method Detail

configPort

public javax.comm.SerialPort configPort(int baudRate,
                                        int databits,
                                        int stopbits,
                                        int parity)
Method that configures the serial port
Parameters:
baudRate - Baud rate of communications
databits - Number of databits
stopbits - Number of stopbits
parity - Parity for communications