|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
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:
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);
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 |
public static final int ALARM_HIGH
public static final int ALARM_LOW
| Method Detail |
public boolean isRelative()
true if this HumidityContainer
provides a relative humidity readinggetHumidityResolution(byte[]),
getHumidityResolutions(),
setHumidityResolution(double, byte[])public boolean hasHumidityAlarms()
true if this HumidityContainer
has high/low trip alarmsgetHumidityAlarm(int, byte[]),
setHumidityAlarm(int, double, byte[])public boolean hasSelectableHumidityResolution()
true if this HumidityContainer
has selectable Humidity resolutiongetHumidityResolution(byte[]),
getHumidityResolutions(),
setHumidityResolution(double, byte[])public double[] getHumidityResolutions()
hasSelectableHumidityResolution(),
getHumidityResolution(byte[]),
setHumidityResolution(double, byte[])
public double getHumidityAlarmResolution()
throws OneWireException
OneWireException - Device does not support Humidity
alarmshasHumidityAlarms(),
getHumidityAlarm(int, byte[]),
setHumidityAlarm(int, double, byte[])
public void doHumidityConvert(byte[] state)
throws OneWireIOException,
OneWireException
state - byte array with device state informationOneWireIOException - 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
adapterpublic double getHumidity(byte[] state)
state - byte array with device state informationhasSelectableHumidityResolution(),
getHumidityResolution(byte[]),
setHumidityResolution(double, byte[])public double getHumidityResolution(byte[] state)
state data retrieved from the readDevice()
method.state - byte array with device state informationhasSelectableHumidityResolution(),
getHumidityResolutions(),
setHumidityResolution(double, byte[])
public double getHumidityAlarm(int alarmType,
byte[] state)
throws OneWireException
state data retrieved from the
readDevice() method.alarmType - valid value: ALARM_HIGH or
ALARM_LOWstate - byte array with device state informationOneWireException - Device does not support Humidity
alarmshasHumidityAlarms(),
setHumidityAlarm(int, double, byte[])
public void setHumidityAlarm(int alarmType,
double alarmValue,
byte[] state)
throws OneWireException
state data.
Use the method writeDevice() with
this data to finalize the change to the device.alarmType - valid value: ALARM_HIGH or
ALARM_LOWalarmValue - alarm trip value in percentstate - byte array with device state informationOneWireException - Device does not support Humidity
alarmshasHumidityAlarms(),
getHumidityAlarm(int, byte[])
public void setHumidityResolution(double resolution,
byte[] state)
throws OneWireException
state data. Use the method writeDevice()
with this data to finalize the change to the device.resolution - Humidity resolution in percentstate - byte array with device state informationOneWireException - Device does not support selectable
Humidity resolutionhasSelectableHumidityResolution(),
getHumidityResolution(byte[]),
getHumidityResolutions()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||