public class BrickletHumidity extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletHumidity.AnalogValueCallbackThreshold |
static interface |
BrickletHumidity.AnalogValueListener
This listener is triggered periodically with the period that is set by
setAnalogValueCallbackPeriod(long) . |
static interface |
BrickletHumidity.AnalogValueReachedListener
This listener is triggered when the threshold as set by
setAnalogValueCallbackThreshold(char, int, int) is reached. |
class |
BrickletHumidity.HumidityCallbackThreshold |
static interface |
BrickletHumidity.HumidityListener
This listener is triggered periodically with the period that is set by
setHumidityCallbackPeriod(long) . |
static interface |
BrickletHumidity.HumidityReachedListener
This listener is triggered when the threshold as set by
setHumidityCallbackThreshold(char, int, int) is reached. |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEVICE_DISPLAY_NAME |
static int |
DEVICE_IDENTIFIER |
static byte |
FUNCTION_GET_ANALOG_VALUE |
static byte |
FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD |
static byte |
FUNCTION_GET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_GET_HUMIDITY |
static byte |
FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD |
static byte |
FUNCTION_SET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD |
static char |
THRESHOLD_OPTION_GREATER |
static char |
THRESHOLD_OPTION_INSIDE |
static char |
THRESHOLD_OPTION_OFF |
static char |
THRESHOLD_OPTION_OUTSIDE |
static char |
THRESHOLD_OPTION_SMALLER |
Constructor and Description |
---|
BrickletHumidity(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final java.lang.String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_GET_HUMIDITY
public static final byte FUNCTION_GET_ANALOG_VALUE
public static final byte FUNCTION_SET_HUMIDITY_CALLBACK_PERIOD
public static final byte FUNCTION_GET_HUMIDITY_CALLBACK_PERIOD
public static final byte FUNCTION_SET_ANALOG_VALUE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_ANALOG_VALUE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_HUMIDITY_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_HUMIDITY_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_ANALOG_VALUE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_ANALOG_VALUE_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_IDENTITY
public static final char THRESHOLD_OPTION_OFF
public static final char THRESHOLD_OPTION_OUTSIDE
public static final char THRESHOLD_OPTION_INSIDE
public static final char THRESHOLD_OPTION_SMALLER
public static final char THRESHOLD_OPTION_GREATER
public BrickletHumidity(java.lang.String uid, IPConnection ipcon)
public int getHumidity() throws TinkerforgeException
BrickletHumidity.HumidityListener
listener and set the period with
setHumidityCallbackPeriod(long)
.TinkerforgeException
public int getAnalogValue() throws TinkerforgeException
getHumidity()
is averaged over several samples
to yield less noise, while getAnalogValue()
gives back raw
unfiltered analog values. The returned humidity value is calibrated for
room temperatures, if you use the sensor in extreme cold or extreme
warm environments, you might want to calculate the humidity from
the analog value yourself. See the `HIH 5030 datasheet
<https://github.com/Tinkerforge/humidity-bricklet/raw/master/datasheets/hih-5030.pdf>`__.
If you want the analog value periodically, it is recommended to use the
BrickletHumidity.AnalogValueListener
listener and set the period with
setAnalogValueCallbackPeriod(long)
.TinkerforgeException
public void setHumidityCallbackPeriod(long period) throws TinkerforgeException
BrickletHumidity.HumidityListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletHumidity.HumidityListener
listener is only triggered if the humidity has changed
since the last triggering.TinkerforgeException
public long getHumidityCallbackPeriod() throws TinkerforgeException
setHumidityCallbackPeriod(long)
.TinkerforgeException
public void setAnalogValueCallbackPeriod(long period) throws TinkerforgeException
BrickletHumidity.AnalogValueListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletHumidity.AnalogValueListener
listener is only triggered if the analog value has
changed since the last triggering.TinkerforgeException
public long getAnalogValueCallbackPeriod() throws TinkerforgeException
setAnalogValueCallbackPeriod(long)
.TinkerforgeException
public void setHumidityCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletHumidity.HumidityReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the humidity is *outside* the min and max values"
"'i'", "Listener is triggered when the humidity is *inside* the min and max values"
"'<'", "Listener is triggered when the humidity is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the humidity is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletHumidity.HumidityCallbackThreshold getHumidityCallbackThreshold() throws TinkerforgeException
setHumidityCallbackThreshold(char, int, int)
.TinkerforgeException
public void setAnalogValueCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletHumidity.AnalogValueReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the analog value is *outside* the min and max values"
"'i'", "Listener is triggered when the analog value is *inside* the min and max values"
"'<'", "Listener is triggered when the analog value is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the analog value is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletHumidity.AnalogValueCallbackThreshold getAnalogValueCallbackThreshold() throws TinkerforgeException
setAnalogValueCallbackThreshold(char, int, int)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletHumidity.HumidityReachedListener
,
* BrickletHumidity.AnalogValueReachedListener
are triggered, if the thresholds
* setHumidityCallbackThreshold(char, int, int)
,
* setAnalogValueCallbackThreshold(char, int, int)
keep being reached.TinkerforgeException
public long getDebouncePeriod() throws TinkerforgeException
setDebouncePeriod(long)
.TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addHumidityListener(BrickletHumidity.HumidityListener listener)
public void removeHumidityListener(BrickletHumidity.HumidityListener listener)
public void addAnalogValueListener(BrickletHumidity.AnalogValueListener listener)
public void removeAnalogValueListener(BrickletHumidity.AnalogValueListener listener)
public void addHumidityReachedListener(BrickletHumidity.HumidityReachedListener listener)
public void removeHumidityReachedListener(BrickletHumidity.HumidityReachedListener listener)
public void addAnalogValueReachedListener(BrickletHumidity.AnalogValueReachedListener listener)
public void removeAnalogValueReachedListener(BrickletHumidity.AnalogValueReachedListener listener)
Copyright © 2020 Tinkerforge GmbH. All rights reserved.