public class BrickletTemperature extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletTemperature.TemperatureCallbackThreshold |
static interface |
BrickletTemperature.TemperatureListener
This listener is triggered periodically with the period that is set by
setTemperatureCallbackPeriod(long) . |
static interface |
BrickletTemperature.TemperatureReachedListener
This listener is triggered when the threshold as set by
setTemperatureCallbackThreshold(char, short, short) 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_DEBOUNCE_PERIOD |
static byte |
FUNCTION_GET_I2C_MODE |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_GET_TEMPERATURE |
static byte |
FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD |
static byte |
FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD |
static byte |
FUNCTION_SET_DEBOUNCE_PERIOD |
static byte |
FUNCTION_SET_I2C_MODE |
static byte |
FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD |
static byte |
FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD |
static short |
I2C_MODE_FAST |
static short |
I2C_MODE_SLOW |
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 |
---|
BrickletTemperature(java.lang.String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addTemperatureListener(BrickletTemperature.TemperatureListener listener)
Adds a Temperature listener.
|
void |
addTemperatureReachedListener(BrickletTemperature.TemperatureReachedListener listener)
Adds a TemperatureReached listener.
|
long |
getDebouncePeriod()
Returns the debounce period as set by
setDebouncePeriod(long) . |
short |
getI2CMode()
Returns the I2C mode as set by
setI2CMode(short) . |
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 |
getTemperature()
Returns the temperature of the sensor.
|
long |
getTemperatureCallbackPeriod()
Returns the period as set by
setTemperatureCallbackPeriod(long) . |
BrickletTemperature.TemperatureCallbackThreshold |
getTemperatureCallbackThreshold()
Returns the threshold as set by
setTemperatureCallbackThreshold(char, short, short) . |
void |
removeTemperatureListener(BrickletTemperature.TemperatureListener listener)
Removes a Temperature listener.
|
void |
removeTemperatureReachedListener(BrickletTemperature.TemperatureReachedListener listener)
Removes a TemperatureReached listener.
|
void |
setDebouncePeriod(long debounce)
Sets the period with which the threshold listener
*
BrickletTemperature.TemperatureReachedListener
is triggered, if the threshold
* setTemperatureCallbackThreshold(char, short, short)
keeps being reached. |
void |
setI2CMode(short mode)
Sets the I2C mode.
|
void |
setTemperatureCallbackPeriod(long period)
Sets the period with which the
BrickletTemperature.TemperatureListener listener is triggered
periodically. |
void |
setTemperatureCallbackThreshold(char option,
short min,
short max)
Sets the thresholds for the
BrickletTemperature.TemperatureReachedListener listener. |
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_TEMPERATURE
public static final byte FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_SET_I2C_MODE
public static final byte FUNCTION_GET_I2C_MODE
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 static final short I2C_MODE_FAST
public static final short I2C_MODE_SLOW
public BrickletTemperature(java.lang.String uid, IPConnection ipcon)
public short getTemperature() throws TinkerforgeException
BrickletTemperature.TemperatureListener
listener and set the period with
setTemperatureCallbackPeriod(long)
.TinkerforgeException
public void setTemperatureCallbackPeriod(long period) throws TinkerforgeException
BrickletTemperature.TemperatureListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletTemperature.TemperatureListener
listener is only triggered if the temperature has changed
since the last triggering.TinkerforgeException
public long getTemperatureCallbackPeriod() throws TinkerforgeException
setTemperatureCallbackPeriod(long)
.TinkerforgeException
public void setTemperatureCallbackThreshold(char option, short min, short max) throws TinkerforgeException
BrickletTemperature.TemperatureReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the temperature is *outside* the min and max values"
"'i'", "Listener is triggered when the temperature is *inside* the min and max values"
"'<'", "Listener is triggered when the temperature is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the temperature is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletTemperature.TemperatureCallbackThreshold getTemperatureCallbackThreshold() throws TinkerforgeException
setTemperatureCallbackThreshold(char, short, short)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletTemperature.TemperatureReachedListener
is triggered, if the threshold
* setTemperatureCallbackThreshold(char, short, short)
keeps being reached.TinkerforgeException
public long getDebouncePeriod() throws TinkerforgeException
setDebouncePeriod(long)
.TinkerforgeException
public void setI2CMode(short mode) throws TinkerforgeException
TinkerforgeException
public short getI2CMode() throws TinkerforgeException
setI2CMode(short)
.
.. versionadded:: 2.0.1$nbsp;(Plugin)TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addTemperatureListener(BrickletTemperature.TemperatureListener listener)
public void removeTemperatureListener(BrickletTemperature.TemperatureListener listener)
public void addTemperatureReachedListener(BrickletTemperature.TemperatureReachedListener listener)
public void removeTemperatureReachedListener(BrickletTemperature.TemperatureReachedListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.