Package com.tinkerforge
Class BrickletCO2
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletCO2
-
public class BrickletCO2 extends Device
Measures CO2 concentration in ppm
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BrickletCO2.CO2ConcentrationCallbackThreshold
static interface
BrickletCO2.CO2ConcentrationListener
This listener is triggered periodically with the period that is set bysetCO2ConcentrationCallbackPeriod(long)
.static interface
BrickletCO2.CO2ConcentrationReachedListener
This listener is triggered when the threshold as set bysetCO2ConcentrationCallbackThreshold(char, int, int)
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_CO2_CONCENTRATION
static byte
FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_PERIOD
static byte
FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_THRESHOLD
static byte
FUNCTION_GET_DEBOUNCE_PERIOD
static byte
FUNCTION_GET_IDENTITY
static byte
FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD
static byte
FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_THRESHOLD
static byte
FUNCTION_SET_DEBOUNCE_PERIOD
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 BrickletCO2(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
addCO2ConcentrationListener(BrickletCO2.CO2ConcentrationListener listener)
Adds a CO2Concentration listener.void
addCO2ConcentrationReachedListener(BrickletCO2.CO2ConcentrationReachedListener listener)
Adds a CO2ConcentrationReached listener.int
getCO2Concentration()
Returns the measured CO2 concentration.long
getCO2ConcentrationCallbackPeriod()
Returns the period as set bysetCO2ConcentrationCallbackPeriod(long)
.BrickletCO2.CO2ConcentrationCallbackThreshold
getCO2ConcentrationCallbackThreshold()
Returns the threshold as set bysetCO2ConcentrationCallbackThreshold(char, int, int)
.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.void
removeCO2ConcentrationListener(BrickletCO2.CO2ConcentrationListener listener)
Removes a CO2Concentration listener.void
removeCO2ConcentrationReachedListener(BrickletCO2.CO2ConcentrationReachedListener listener)
Removes a CO2ConcentrationReached listener.void
setCO2ConcentrationCallbackPeriod(long period)
Sets the period with which theBrickletCO2.CO2ConcentrationListener
listener is triggered periodically.void
setCO2ConcentrationCallbackThreshold(char option, int min, int max)
Sets the thresholds for theBrickletCO2.CO2ConcentrationReachedListener
listener.void
setDebouncePeriod(long debounce)
Sets the period with which the threshold listeners *BrickletCO2.CO2ConcentrationReachedListener
, are triggered, if the thresholds *setCO2ConcentrationCallbackThreshold(char, int, int)
, keep being reached.-
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_CO2_CONCENTRATION
public static final byte FUNCTION_GET_CO2_CONCENTRATION
- See Also:
- Constant Field Values
-
FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD
public static final byte FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_PERIOD
public static final byte FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_CO2_CONCENTRATION_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_GET_CO2_CONCENTRATION_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_CO2_CONCENTRATION_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
-
BrickletCO2
public BrickletCO2(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
-
getCO2Concentration
public int getCO2Concentration() throws TinkerforgeException
Returns the measured CO2 concentration. If you want to get the CO2 concentration periodically, it is recommended to use theBrickletCO2.CO2ConcentrationListener
listener and set the period withsetCO2ConcentrationCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setCO2ConcentrationCallbackPeriod
public void setCO2ConcentrationCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletCO2.CO2ConcentrationListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletCO2.CO2ConcentrationListener
listener is only triggered if the CO2 concentration has changed since the last triggering.- Throws:
TinkerforgeException
-
getCO2ConcentrationCallbackPeriod
public long getCO2ConcentrationCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetCO2ConcentrationCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setCO2ConcentrationCallbackThreshold
public void setCO2ConcentrationCallbackThreshold(char option, int min, int max) throws TinkerforgeException
Sets the thresholds for theBrickletCO2.CO2ConcentrationReachedListener
listener. The following options are possible: \verbatim "Option", "Description" "'x'", "Listener is turned off" "'o'", "Listener is triggered when the CO2 concentration is *outside* the min and max values" "'i'", "Listener is triggered when the CO2 concentration is *inside* the min and max values" "'<'", "Listener is triggered when the CO2 concentration is smaller than the min value (max is ignored)" "'>'", "Listener is triggered when the CO2 concentration is greater than the min value (max is ignored)" \endverbatim- Throws:
TinkerforgeException
-
getCO2ConcentrationCallbackThreshold
public BrickletCO2.CO2ConcentrationCallbackThreshold getCO2ConcentrationCallbackThreshold() throws TinkerforgeException
Returns the threshold as set bysetCO2ConcentrationCallbackThreshold(char, int, int)
.- Throws:
TinkerforgeException
-
setDebouncePeriod
public void setDebouncePeriod(long debounce) throws TinkerforgeException
Sets the period with which the threshold listeners *BrickletCO2.CO2ConcentrationReachedListener
, are triggered, if the thresholds *setCO2ConcentrationCallbackThreshold(char, int, int)
, 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
-
addCO2ConcentrationListener
public void addCO2ConcentrationListener(BrickletCO2.CO2ConcentrationListener listener)
Adds a CO2Concentration listener.
-
removeCO2ConcentrationListener
public void removeCO2ConcentrationListener(BrickletCO2.CO2ConcentrationListener listener)
Removes a CO2Concentration listener.
-
addCO2ConcentrationReachedListener
public void addCO2ConcentrationReachedListener(BrickletCO2.CO2ConcentrationReachedListener listener)
Adds a CO2ConcentrationReached listener.
-
removeCO2ConcentrationReachedListener
public void removeCO2ConcentrationReachedListener(BrickletCO2.CO2ConcentrationReachedListener listener)
Removes a CO2ConcentrationReached listener.
-
-