public class BrickletDustDetector extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletDustDetector.DustDensityCallbackThreshold |
static interface |
BrickletDustDetector.DustDensityListener
This listener is triggered periodically with the period that is set by
setDustDensityCallbackPeriod(long) . |
static interface |
BrickletDustDetector.DustDensityReachedListener
This listener is triggered when the threshold as set by
setDustDensityCallbackThreshold(char, int, int) is reached. |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static String |
DEVICE_DISPLAY_NAME |
static int |
DEVICE_IDENTIFIER |
static byte |
FUNCTION_GET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_GET_DUST_DENSITY |
static byte |
FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_GET_MOVING_AVERAGE |
static byte |
FUNCTION_SET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD |
static byte |
FUNCTION_SET_MOVING_AVERAGE |
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 |
---|
BrickletDustDetector(String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addDustDensityListener(BrickletDustDetector.DustDensityListener listener)
Adds a DustDensity listener.
|
void |
addDustDensityReachedListener(BrickletDustDetector.DustDensityReachedListener listener)
Adds a DustDensityReached listener.
|
long |
getDebouncePeriod()
Returns the debounce period as set by
setDebouncePeriod(long) . |
int |
getDustDensity()
Returns the dust density.
|
long |
getDustDensityCallbackPeriod()
Returns the period as set by
setDustDensityCallbackPeriod(long) . |
BrickletDustDetector.DustDensityCallbackThreshold |
getDustDensityCallbackThreshold()
Returns the threshold as set by
setDustDensityCallbackThreshold(char, int, int) . |
Device.Identity |
getIdentity()
Returns the UID, the UID where the Bricklet is connected to,
the position, the hardware and firmware version as well as the
device identifier.
|
short |
getMovingAverage()
Returns the length moving average as set by
setMovingAverage(short) . |
void |
removeDustDensityListener(BrickletDustDetector.DustDensityListener listener)
Removes a DustDensity listener.
|
void |
removeDustDensityReachedListener(BrickletDustDetector.DustDensityReachedListener listener)
Removes a DustDensityReached listener.
|
void |
setDebouncePeriod(long debounce)
Sets the period with which the threshold listener
*
BrickletDustDetector.DustDensityReachedListener
is triggered, if the threshold
* setDustDensityCallbackThreshold(char, int, int)
keeps being reached. |
void |
setDustDensityCallbackPeriod(long period)
Sets the period with which the
BrickletDustDetector.DustDensityListener listener is triggered
periodically. |
void |
setDustDensityCallbackThreshold(char option,
int min,
int max)
Sets the thresholds for the
BrickletDustDetector.DustDensityReachedListener listener. |
void |
setMovingAverage(short average)
Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__
for the dust density.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_GET_DUST_DENSITY
public static final byte FUNCTION_SET_DUST_DENSITY_CALLBACK_PERIOD
public static final byte FUNCTION_GET_DUST_DENSITY_CALLBACK_PERIOD
public static final byte FUNCTION_SET_DUST_DENSITY_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_DUST_DENSITY_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_SET_MOVING_AVERAGE
public static final byte FUNCTION_GET_MOVING_AVERAGE
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 BrickletDustDetector(String uid, IPConnection ipcon)
public int getDustDensity() throws TinkerforgeException
BrickletDustDetector.DustDensityListener
listener and set the period with
setDustDensityCallbackPeriod(long)
.TinkerforgeException
public void setDustDensityCallbackPeriod(long period) throws TinkerforgeException
BrickletDustDetector.DustDensityListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletDustDetector.DustDensityListener
listener is only triggered if the dust density has
changed since the last triggering.TinkerforgeException
public long getDustDensityCallbackPeriod() throws TinkerforgeException
setDustDensityCallbackPeriod(long)
.TinkerforgeException
public void setDustDensityCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletDustDetector.DustDensityReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the dust density value is *outside* the min and max values"
"'i'", "Listener is triggered when the dust density value is *inside* the min and max values"
"'<'", "Listener is triggered when the dust density value is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the dust density value is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletDustDetector.DustDensityCallbackThreshold getDustDensityCallbackThreshold() throws TinkerforgeException
setDustDensityCallbackThreshold(char, int, int)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletDustDetector.DustDensityReachedListener
is triggered, if the threshold
* setDustDensityCallbackThreshold(char, int, int)
keeps being reached.TinkerforgeException
public long getDebouncePeriod() throws TinkerforgeException
setDebouncePeriod(long)
.TinkerforgeException
public void setMovingAverage(short average) throws TinkerforgeException
TinkerforgeException
public short getMovingAverage() throws TinkerforgeException
setMovingAverage(short)
.TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addDustDensityListener(BrickletDustDetector.DustDensityListener listener)
public void removeDustDensityListener(BrickletDustDetector.DustDensityListener listener)
public void addDustDensityReachedListener(BrickletDustDetector.DustDensityReachedListener listener)
public void removeDustDensityReachedListener(BrickletDustDetector.DustDensityReachedListener listener)
Copyright © 2022 Tinkerforge GmbH. All rights reserved.