Dallas Semiconductor 1-Wire API 1.00 Alpha: Interface HumidityContainer

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.dalsemi.onewire.container
Interface HumidityContainer

All Superinterfaces:
  OneWireSensor

All Known Implementing Classes:
  OneWireContainer26

public interface HumidityContainer
extends OneWireSensor

1-Wire Humidity interface class for basic Humidity measuring operations. This class should be implemented for each Humidity type 1-Wire device.

The HumidityContainer methods can be organized into the following categories:

- Information
  - `getHumidity`
  - `getHumidityResolution`
  - `getHumidityAlarm`
  - `getHumidityAlarmResolution`
  - `getHumidityResolution`
  - `getHumidityResolutions`
  - `hasSelectableHumidityResolution`
  - `hasHumidityAlarms`
  - `isRelative`
- Options
  - `doHumidityConvert`
  - `setHumidityAlarm`
  - `setHumidityResolution`
- I/O
  - `readDevice`
  - `writeDevice`

### Usage

  #### Example

  Gets humidity reading from a HumidityContainer instance '`hc`':

         double lastHumidity;

         // get the current resolution and other settings of the device (done only once)
         byte[] state = hc.readDevice();

         // loop to read the humidity
         do
         {
            // perform a humidity conversion
            hc.doHumidityConvert(state);

            // read the result of the conversion
            state = hc.readDevice();

            // extract the result out of state
            lastHumidity = hc.getHumidity(state);
            ...

         }
         while (!done);

  Version:
    0.00, 27 August 2001
  See Also:
    `OneWireContainer28`

  Field Summary
  `static int` | `ALARM_HIGH` high temperature alarm
  `static int` | `ALARM_LOW` low temperature alarm

  Method Summary
  `void` | `doHumidityConvert(byte[] state)` Performs a Humidity conversion.
  `double` | `getHumidity(byte[] state)` Gets the humidity expressed as a percent value (0.0 to 100.0) of humidity.
  `double` | `getHumidityAlarm(int alarmType, byte[] state)` Gets the specified Humidity alarm value in percent from the `state` data retrieved from the `readDevice()` method.
  `double` | `getHumidityAlarmResolution()` Gets the Humidity alarm resolution in percent.
  `double` | `getHumidityResolution(byte[] state)` Gets the current Humidity resolution in percent from the `state` data retrieved from the `readDevice()` method.
  `double[]` | `getHumidityResolutions()` Get an array of available Humidity resolutions in percent humidity (0 to 100).
  `boolean` | `hasHumidityAlarms()` Checks to see if this Humidity measuring device has high/low trip alarms.
  `boolean` | `hasSelectableHumidityResolution()` Checks to see if this device has selectable Humidity resolution.
  `boolean` | `isRelative()` Checks to see if humidity value given is a 'relative' humidity value.
  `void` | `setHumidityAlarm(int alarmType, double alarmValue, byte[] state)` Sets the Humidity alarm value in percent in the provided `state` data.
  `void` | `setHumidityResolution(double resolution, byte[] state)` Sets the current Humidity resolution in percent in the provided `state` data.

  Methods inherited from interface com.dalsemi.onewire.container.OneWireSensor
  `readDevice, writeDevice`

  Field Detail

  ### ALARM_HIGH

      public static final int ALARM_HIGH

    high temperature alarm

  ### ALARM_LOW

      public static final int ALARM_LOW

    low temperature alarm

  Method Detail

  ### isRelative

      public boolean isRelative()

    Checks to see if humidity value given is a 'relative' humidity value.
    Returns:
      `true` if this `HumidityContainer` provides a relative humidity reading
    See Also:
      `getHumidityResolution(byte[])`, `getHumidityResolutions()`, `setHumidityResolution(double, byte[])`

  ### hasHumidityAlarms

      public boolean hasHumidityAlarms()

    Checks to see if this Humidity measuring device has high/low trip alarms.
    Returns:
      `true` if this `HumidityContainer` has high/low trip alarms
    See Also:
      `getHumidityAlarm(int, byte[])`, `setHumidityAlarm(int, double, byte[])`

  ### hasSelectableHumidityResolution

      public boolean hasSelectableHumidityResolution()

    Checks to see if this device has selectable Humidity resolution.
    Returns:
      `true` if this `HumidityContainer` has selectable Humidity resolution
    See Also:
      `getHumidityResolution(byte[])`, `getHumidityResolutions()`, `setHumidityResolution(double, byte[])`

  ### getHumidityResolutions

      public double[] getHumidityResolutions()

    Get an array of available Humidity resolutions in percent humidity (0 to 100).
    Returns:
      byte array of available Humidity resolutions in percent with minimum resolution as the first element and maximum resolution as the last element.
    See Also:
      `hasSelectableHumidityResolution()`, `getHumidityResolution(byte[])`, `setHumidityResolution(double, byte[])`

  ### getHumidityAlarmResolution

      public double getHumidityAlarmResolution()
                                        throws OneWireException

    Gets the Humidity alarm resolution in percent.
    Returns:
      Humidity alarm resolution in percent for this 1-wire device
    Throws:
      `OneWireException` - Device does not support Humidity alarms
    See Also:
      `hasHumidityAlarms()`, `getHumidityAlarm(int, byte[])`, `setHumidityAlarm(int, double, byte[])`

  ### doHumidityConvert

      public void doHumidityConvert(byte[] state)
                             throws OneWireIOException,
                                    OneWireException

    Performs a Humidity conversion.
    Parameters:
      `state` - byte array with device state information
    Throws:
      `OneWireIOException` - on a 1-Wire communication error such as reading an incorrect CRC from a 1-Wire device. This could be caused by a physical interruption in the 1-Wire Network due to shorts or a newly arriving 1-Wire device issuing a 'presence pulse'.
      `OneWireException` - on a communication or setup error with the 1-Wire adapter

  ### getHumidity

      public double getHumidity(byte[] state)

    Gets the humidity expressed as a percent value (0.0 to 100.0) of humidity.
    Parameters:
      `state` - byte array with device state information
    Returns:
      humidity expressed as a percent
    See Also:
      `hasSelectableHumidityResolution()`, `getHumidityResolution(byte[])`, `setHumidityResolution(double, byte[])`

  ### getHumidityResolution

      public double getHumidityResolution(byte[] state)

    Gets the current Humidity resolution in percent from the `state` data retrieved from the `readDevice()` method.
    Parameters:
      `state` - byte array with device state information
    Returns:
      Humidity resolution in percent for this 1-wire device
    See Also:
      `hasSelectableHumidityResolution()`, `getHumidityResolutions()`, `setHumidityResolution(double, byte[])`

  ### getHumidityAlarm

      public double getHumidityAlarm(int alarmType,
                                     byte[] state)
                              throws OneWireException

    Gets the specified Humidity alarm value in percent from the `state` data retrieved from the `readDevice()` method.
    Parameters:
      `alarmType` - valid value: `ALARM_HIGH` or `ALARM_LOW`
      `state` - byte array with device state information
    Returns:
      Humidity alarm trip values in percent for this 1-wire device
    Throws:
      `OneWireException` - Device does not support Humidity alarms
    See Also:
      `hasHumidityAlarms()`, `setHumidityAlarm(int, double, byte[])`

  ### setHumidityAlarm

      public void setHumidityAlarm(int alarmType,
                                   double alarmValue,
                                   byte[] state)
                            throws OneWireException

    Sets the Humidity alarm value in percent in the provided `state` data. Use the method `writeDevice()` with this data to finalize the change to the device.
    Parameters:
      `alarmType` - valid value: `ALARM_HIGH` or `ALARM_LOW`
      `alarmValue` - alarm trip value in percent
      `state` - byte array with device state information
    Throws:
      `OneWireException` - Device does not support Humidity alarms
    See Also:
      `hasHumidityAlarms()`, `getHumidityAlarm(int, byte[])`

  ### setHumidityResolution

      public void setHumidityResolution(double resolution,
                                        byte[] state)
                                 throws OneWireException

    Sets the current Humidity resolution in percent in the provided `state` data. Use the method `writeDevice()` with this data to finalize the change to the device.
    Parameters:
      `resolution` - Humidity resolution in percent
      `state` - byte array with device state information
    Throws:
      `OneWireException` - Device does not support selectable Humidity resolution
    See Also:
      `hasSelectableHumidityResolution()`, `getHumidityResolution(byte[])`, `getHumidityResolutions()`

  Overview | Package | Class | Tree | Deprecated | Index | Help
  PREV CLASS NEXT CLASS | FRAMES NO FRAMES
  SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD