public void collect() {

    try {
      int range = tempSensor.getRange();
      // System.err.println("Temperature device an instance of " + tempSensor.getClass() + ", with
      // range = " + range);
      int temp = tempSensor.getValue(); // The raw reading
      double tempF = tempSensor.getFahrenheit(); // The value converted to Farenheight
      double tempC = tempSensor.getCelsius(); // The value converted to Celcius.
      // System.err.println("tempSensor.getValue() = " + temp + " (raw value) = " + tempF + "
      // degrees F = " + tempC + " degrees C.");
      Object content = new TemperatureSensorData(tempC, tempF);
      fireEvent(new TemperatureEvent(content));
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }
 public void disableThresholds() {
   tempSensor.removeITemperatureInputThresholdListener(this);
   tempSensor.enableThresholdEvents(false);
 }
 public void enableThresholds(double low, double high, boolean celsius) {
   tempSensor.addITemperatureInputThresholdListener(this);
   tempSensor.setThresholds(low, high, celsius);
   tempSensor.enableThresholdEvents(true);
 }