Package com.tinkerforge
Class BrickletUVLight
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletUVLight
-
public class BrickletUVLight extends Device
Measures UV light
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BrickletUVLight.UVLightCallbackThreshold
static interface
BrickletUVLight.UVLightListener
This listener is triggered periodically with the period that is set bysetUVLightCallbackPeriod(long)
.static interface
BrickletUVLight.UVLightReachedListener
This listener is triggered when the threshold as set bysetUVLightCallbackThreshold(char, long, long)
is reached.-
Nested classes/interfaces inherited from class com.tinkerforge.Device
Device.Identity
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEVICE_DISPLAY_NAME
static int
DEVICE_IDENTIFIER
static byte
FUNCTION_GET_DEBOUNCE_PERIOD
static byte
FUNCTION_GET_IDENTITY
static byte
FUNCTION_GET_UV_LIGHT
static byte
FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD
static byte
FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD
static byte
FUNCTION_SET_DEBOUNCE_PERIOD
static byte
FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD
static byte
FUNCTION_SET_UV_LIGHT_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 Summary
Constructors Constructor Description BrickletUVLight(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUVLightListener(BrickletUVLight.UVLightListener listener)
Adds a UVLight listener.void
addUVLightReachedListener(BrickletUVLight.UVLightReachedListener listener)
Adds a UVLightReached listener.long
getDebouncePeriod()
Returns the debounce period as set bysetDebouncePeriod(long)
.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.long
getUVLight()
Returns the UV light intensity of the sensor.long
getUVLightCallbackPeriod()
Returns the period as set bysetUVLightCallbackPeriod(long)
.BrickletUVLight.UVLightCallbackThreshold
getUVLightCallbackThreshold()
Returns the threshold as set bysetUVLightCallbackThreshold(char, long, long)
.void
removeUVLightListener(BrickletUVLight.UVLightListener listener)
Removes a UVLight listener.void
removeUVLightReachedListener(BrickletUVLight.UVLightReachedListener listener)
Removes a UVLightReached listener.void
setDebouncePeriod(long debounce)
Sets the period with which the threshold listeners *BrickletUVLight.UVLightReachedListener
, are triggered, if the thresholds *setUVLightCallbackThreshold(char, long, long)
, keep being reached.void
setUVLightCallbackPeriod(long period)
Sets the period with which theBrickletUVLight.UVLightListener
listener is triggered periodically.void
setUVLightCallbackThreshold(char option, long min, long max)
Sets the thresholds for theBrickletUVLight.UVLightReachedListener
listener.-
Methods inherited from class com.tinkerforge.DeviceBase
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
-
-
-
-
Field Detail
-
DEVICE_IDENTIFIER
public static final int DEVICE_IDENTIFIER
- See Also:
- Constant Field Values
-
DEVICE_DISPLAY_NAME
public static final java.lang.String DEVICE_DISPLAY_NAME
- See Also:
- Constant Field Values
-
FUNCTION_GET_UV_LIGHT
public static final byte FUNCTION_GET_UV_LIGHT
- See Also:
- Constant Field Values
-
FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD
public static final byte FUNCTION_SET_UV_LIGHT_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD
public static final byte FUNCTION_GET_UV_LIGHT_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_UV_LIGHT_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_UV_LIGHT_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_SET_DEBOUNCE_PERIOD
public static final byte FUNCTION_SET_DEBOUNCE_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_IDENTITY
public static final byte FUNCTION_GET_IDENTITY
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_OFF
public static final char THRESHOLD_OPTION_OFF
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_OUTSIDE
public static final char THRESHOLD_OPTION_OUTSIDE
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_INSIDE
public static final char THRESHOLD_OPTION_INSIDE
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_SMALLER
public static final char THRESHOLD_OPTION_SMALLER
- See Also:
- Constant Field Values
-
THRESHOLD_OPTION_GREATER
public static final char THRESHOLD_OPTION_GREATER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletUVLight
public BrickletUVLight(java.lang.String uid, IPConnection ipcon)
Creates an object with the unique device ID \c uid. and adds it to the IP Connection \c ipcon.
-
-
Method Detail
-
getUVLight
public long getUVLight() throws TinkerforgeException
Returns the UV light intensity of the sensor. The sensor has already weighted the intensity with the erythemal action spectrum to get the skin-affecting irradiation. To get UV index you just have to divide the value by 250. For example, a UV light intensity of 500 is equivalent to an UV index of 2. If you want to get the intensity periodically, it is recommended to use theBrickletUVLight.UVLightListener
listener and set the period withsetUVLightCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setUVLightCallbackPeriod
public void setUVLightCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletUVLight.UVLightListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletUVLight.UVLightListener
listener is only triggered if the intensity has changed since the last triggering.- Throws:
TinkerforgeException
-
getUVLightCallbackPeriod
public long getUVLightCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetUVLightCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setUVLightCallbackThreshold
public void setUVLightCallbackThreshold(char option, long min, long max) throws TinkerforgeException
Sets the thresholds for theBrickletUVLight.UVLightReachedListener
listener. The following options are possible: \verbatim "Option", "Description" "'x'", "Listener is turned off" "'o'", "Listener is triggered when the intensity is *outside* the min and max values" "'i'", "Listener is triggered when the intensity is *inside* the min and max values" "'<'", "Listener is triggered when the intensity is smaller than the min value (max is ignored)" "'>'", "Listener is triggered when the intensity is greater than the min value (max is ignored)" \endverbatim- Throws:
TinkerforgeException
-
getUVLightCallbackThreshold
public BrickletUVLight.UVLightCallbackThreshold getUVLightCallbackThreshold() throws TinkerforgeException
Returns the threshold as set bysetUVLightCallbackThreshold(char, long, long)
.- Throws:
TinkerforgeException
-
setDebouncePeriod
public void setDebouncePeriod(long debounce) throws TinkerforgeException
Sets the period with which the threshold listeners *BrickletUVLight.UVLightReachedListener
, are triggered, if the thresholds *setUVLightCallbackThreshold(char, long, long)
, keep being reached.- Throws:
TinkerforgeException
-
getDebouncePeriod
public long getDebouncePeriod() throws TinkerforgeException
Returns the debounce period as set bysetDebouncePeriod(long)
.- Throws:
TinkerforgeException
-
getIdentity
public Device.Identity getIdentity() throws TinkerforgeException
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at position 'z'. The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|- Specified by:
getIdentity
in classDevice
- Throws:
TinkerforgeException
-
addUVLightListener
public void addUVLightListener(BrickletUVLight.UVLightListener listener)
Adds a UVLight listener.
-
removeUVLightListener
public void removeUVLightListener(BrickletUVLight.UVLightListener listener)
Removes a UVLight listener.
-
addUVLightReachedListener
public void addUVLightReachedListener(BrickletUVLight.UVLightReachedListener listener)
Adds a UVLightReached listener.
-
removeUVLightReachedListener
public void removeUVLightReachedListener(BrickletUVLight.UVLightReachedListener listener)
Removes a UVLightReached listener.
-
-