public class BrickletAmbientLight extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletAmbientLight.AnalogValueCallbackThreshold |
static interface |
BrickletAmbientLight.AnalogValueListener
This listener is triggered periodically with the period that is set by
setAnalogValueCallbackPeriod(long) . |
static interface |
BrickletAmbientLight.AnalogValueReachedListener
This listener is triggered when the threshold as set by
setAnalogValueCallbackThreshold(char, int, int) is reached. |
class |
BrickletAmbientLight.IlluminanceCallbackThreshold |
static interface |
BrickletAmbientLight.IlluminanceListener
This listener is triggered periodically with the period that is set by
setIlluminanceCallbackPeriod(long) . |
static interface |
BrickletAmbientLight.IlluminanceReachedListener
This listener is triggered when the threshold as set by
setIlluminanceCallbackThreshold(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_IDENTITY |
static byte |
FUNCTION_GET_ILLUMINANCE |
static byte |
FUNCTION_GET_ILLUMINANCE_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_ILLUMINANCE_CALLBACK_THRESHOLD |
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_ILLUMINANCE_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_ILLUMINANCE_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 |
---|
BrickletAmbientLight(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_ILLUMINANCE
public static final byte FUNCTION_GET_ANALOG_VALUE
public static final byte FUNCTION_SET_ILLUMINANCE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_ILLUMINANCE_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_ILLUMINANCE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_ILLUMINANCE_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 BrickletAmbientLight(java.lang.String uid, IPConnection ipcon)
public int getIlluminance() throws TinkerforgeException
BrickletAmbientLight.IlluminanceListener
listener and set the period with
setIlluminanceCallbackPeriod(long)
.TinkerforgeException
public int getAnalogValue() throws TinkerforgeException
getIlluminance()
is averaged over several samples
to yield less noise, while getAnalogValue()
gives back raw
unfiltered analog values. The only reason to use getAnalogValue()
is,
if you need the full resolution of the analog-to-digital converter.
Also, the analog-to-digital converter covers three different ranges that are
set dynamically depending on the light intensity. It is impossible to
distinguish between these ranges with the analog value.
If you want the analog value periodically, it is recommended to use the
BrickletAmbientLight.AnalogValueListener
listener and set the period with
setAnalogValueCallbackPeriod(long)
.TinkerforgeException
public void setIlluminanceCallbackPeriod(long period) throws TinkerforgeException
BrickletAmbientLight.IlluminanceListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletAmbientLight.IlluminanceListener
listener is only triggered if the illuminance has changed
since the last triggering.TinkerforgeException
public long getIlluminanceCallbackPeriod() throws TinkerforgeException
setIlluminanceCallbackPeriod(long)
.TinkerforgeException
public void setAnalogValueCallbackPeriod(long period) throws TinkerforgeException
BrickletAmbientLight.AnalogValueListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletAmbientLight.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 setIlluminanceCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletAmbientLight.IlluminanceReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the illuminance is *outside* the min and max values"
"'i'", "Listener is triggered when the illuminance is *inside* the min and max values"
"'<'", "Listener is triggered when the illuminance is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the illuminance is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletAmbientLight.IlluminanceCallbackThreshold getIlluminanceCallbackThreshold() throws TinkerforgeException
setIlluminanceCallbackThreshold(char, int, int)
.TinkerforgeException
public void setAnalogValueCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletAmbientLight.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 BrickletAmbientLight.AnalogValueCallbackThreshold getAnalogValueCallbackThreshold() throws TinkerforgeException
setAnalogValueCallbackThreshold(char, int, int)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletAmbientLight.IlluminanceReachedListener
,
* BrickletAmbientLight.AnalogValueReachedListener
are triggered, if the thresholds
* setIlluminanceCallbackThreshold(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 addIlluminanceListener(BrickletAmbientLight.IlluminanceListener listener)
public void removeIlluminanceListener(BrickletAmbientLight.IlluminanceListener listener)
public void addAnalogValueListener(BrickletAmbientLight.AnalogValueListener listener)
public void removeAnalogValueListener(BrickletAmbientLight.AnalogValueListener listener)
public void addIlluminanceReachedListener(BrickletAmbientLight.IlluminanceReachedListener listener)
public void removeIlluminanceReachedListener(BrickletAmbientLight.IlluminanceReachedListener listener)
public void addAnalogValueReachedListener(BrickletAmbientLight.AnalogValueReachedListener listener)
public void removeAnalogValueReachedListener(BrickletAmbientLight.AnalogValueReachedListener listener)
Copyright © 2020 Tinkerforge GmbH. All rights reserved.