public class BrickletBarometer extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletBarometer.AirPressureCallbackThreshold |
static interface |
BrickletBarometer.AirPressureListener
This listener is triggered periodically with the period that is set by
setAirPressureCallbackPeriod(long) . |
static interface |
BrickletBarometer.AirPressureReachedListener
This listener is triggered when the threshold as set by
setAirPressureCallbackThreshold(char, int, int) is reached. |
class |
BrickletBarometer.AltitudeCallbackThreshold |
static interface |
BrickletBarometer.AltitudeListener
This listener is triggered periodically with the period that is set by
setAltitudeCallbackPeriod(long) . |
static interface |
BrickletBarometer.AltitudeReachedListener
This listener is triggered when the threshold as set by
setAltitudeCallbackThreshold(char, int, int) is reached. |
class |
BrickletBarometer.Averaging |
Device.Identity
Constructor and Description |
---|
BrickletBarometer(String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addAirPressureListener(BrickletBarometer.AirPressureListener listener)
Adds a AirPressure listener.
|
void |
addAirPressureReachedListener(BrickletBarometer.AirPressureReachedListener listener)
Adds a AirPressureReached listener.
|
void |
addAltitudeListener(BrickletBarometer.AltitudeListener listener)
Adds a Altitude listener.
|
void |
addAltitudeReachedListener(BrickletBarometer.AltitudeReachedListener listener)
Adds a AltitudeReached listener.
|
int |
getAirPressure()
Returns the air pressure of the air pressure sensor.
|
long |
getAirPressureCallbackPeriod()
Returns the period as set by
setAirPressureCallbackPeriod(long) . |
BrickletBarometer.AirPressureCallbackThreshold |
getAirPressureCallbackThreshold()
Returns the threshold as set by
setAirPressureCallbackThreshold(char, int, int) . |
int |
getAltitude()
Returns the relative altitude of the air pressure sensor.
|
long |
getAltitudeCallbackPeriod()
Returns the period as set by
setAltitudeCallbackPeriod(long) . |
BrickletBarometer.AltitudeCallbackThreshold |
getAltitudeCallbackThreshold()
Returns the threshold as set by
setAltitudeCallbackThreshold(char, int, int) . |
BrickletBarometer.Averaging |
getAveraging()
Returns the averaging configuration as set by
setAveraging(short, short, short) . |
short |
getChipTemperature()
Returns the temperature of the air pressure sensor.
|
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.
|
int |
getReferenceAirPressure()
Returns the reference air pressure as set by
setReferenceAirPressure(int) . |
void |
removeAirPressureListener(BrickletBarometer.AirPressureListener listener)
Removes a AirPressure listener.
|
void |
removeAirPressureReachedListener(BrickletBarometer.AirPressureReachedListener listener)
Removes a AirPressureReached listener.
|
void |
removeAltitudeListener(BrickletBarometer.AltitudeListener listener)
Removes a Altitude listener.
|
void |
removeAltitudeReachedListener(BrickletBarometer.AltitudeReachedListener listener)
Removes a AltitudeReached listener.
|
void |
setAirPressureCallbackPeriod(long period)
Sets the period with which the
BrickletBarometer.AirPressureListener listener is triggered
periodically. |
void |
setAirPressureCallbackThreshold(char option,
int min,
int max)
Sets the thresholds for the
BrickletBarometer.AirPressureReachedListener listener. |
void |
setAltitudeCallbackPeriod(long period)
Sets the period with which the
BrickletBarometer.AltitudeListener listener is triggered
periodically. |
void |
setAltitudeCallbackThreshold(char option,
int min,
int max)
Sets the thresholds for the
BrickletBarometer.AltitudeReachedListener listener. |
void |
setAveraging(short movingAveragePressure,
short averagePressure,
short averageTemperature)
Sets the different averaging parameters.
|
void |
setDebouncePeriod(long debounce)
Sets the period with which the threshold listeners
*
BrickletBarometer.AirPressureReachedListener ,
* BrickletBarometer.AltitudeReachedListener
are triggered, if the thresholds
* setAirPressureCallbackThreshold(char, int, int) ,
* setAltitudeCallbackThreshold(char, int, int)
keep being reached. |
void |
setI2CMode(short mode)
Sets the I2C mode.
|
void |
setReferenceAirPressure(int airPressure)
Sets the reference air pressure for the altitude calculation.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_GET_AIR_PRESSURE
public static final byte FUNCTION_GET_ALTITUDE
public static final byte FUNCTION_SET_AIR_PRESSURE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_AIR_PRESSURE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_ALTITUDE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_ALTITUDE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_AIR_PRESSURE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_AIR_PRESSURE_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_ALTITUDE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_ALTITUDE_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_DEBOUNCE_PERIOD
public static final byte FUNCTION_GET_DEBOUNCE_PERIOD
public static final byte FUNCTION_SET_REFERENCE_AIR_PRESSURE
public static final byte FUNCTION_GET_CHIP_TEMPERATURE
public static final byte FUNCTION_GET_REFERENCE_AIR_PRESSURE
public static final byte FUNCTION_SET_AVERAGING
public static final byte FUNCTION_GET_AVERAGING
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 BrickletBarometer(String uid, IPConnection ipcon)
public int getAirPressure() throws TinkerforgeException
BrickletBarometer.AirPressureListener
listener and set the period with
setAirPressureCallbackPeriod(long)
.TinkerforgeException
public int getAltitude() throws TinkerforgeException
setReferenceAirPressure(int)
.
If you want to get the altitude periodically, it is recommended to use the
BrickletBarometer.AltitudeListener
listener and set the period with
setAltitudeCallbackPeriod(long)
.TinkerforgeException
public void setAirPressureCallbackPeriod(long period) throws TinkerforgeException
BrickletBarometer.AirPressureListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletBarometer.AirPressureListener
listener is only triggered if the air pressure has
changed since the last triggering.TinkerforgeException
public long getAirPressureCallbackPeriod() throws TinkerforgeException
setAirPressureCallbackPeriod(long)
.TinkerforgeException
public void setAltitudeCallbackPeriod(long period) throws TinkerforgeException
BrickletBarometer.AltitudeListener
listener is triggered
periodically. A value of 0 turns the listener off.
The BrickletBarometer.AltitudeListener
listener is only triggered if the altitude has changed since
the last triggering.TinkerforgeException
public long getAltitudeCallbackPeriod() throws TinkerforgeException
setAltitudeCallbackPeriod(long)
.TinkerforgeException
public void setAirPressureCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletBarometer.AirPressureReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the air pressure is *outside* the min and max values"
"'i'", "Listener is triggered when the air pressure is *inside* the min and max values"
"'<'", "Listener is triggered when the air pressure is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the air pressure is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletBarometer.AirPressureCallbackThreshold getAirPressureCallbackThreshold() throws TinkerforgeException
setAirPressureCallbackThreshold(char, int, int)
.TinkerforgeException
public void setAltitudeCallbackThreshold(char option, int min, int max) throws TinkerforgeException
BrickletBarometer.AltitudeReachedListener
listener.
The following options are possible:
\verbatim
"Option", "Description"
"'x'", "Listener is turned off"
"'o'", "Listener is triggered when the altitude is *outside* the min and max values"
"'i'", "Listener is triggered when the altitude is *inside* the min and max values"
"'<'", "Listener is triggered when the altitude is smaller than the min value (max is ignored)"
"'>'", "Listener is triggered when the altitude is greater than the min value (max is ignored)"
\endverbatimTinkerforgeException
public BrickletBarometer.AltitudeCallbackThreshold getAltitudeCallbackThreshold() throws TinkerforgeException
setAltitudeCallbackThreshold(char, int, int)
.TinkerforgeException
public void setDebouncePeriod(long debounce) throws TinkerforgeException
BrickletBarometer.AirPressureReachedListener
,
* BrickletBarometer.AltitudeReachedListener
are triggered, if the thresholds
* setAirPressureCallbackThreshold(char, int, int)
,
* setAltitudeCallbackThreshold(char, int, int)
keep being reached.TinkerforgeException
public long getDebouncePeriod() throws TinkerforgeException
setDebouncePeriod(long)
.TinkerforgeException
public void setReferenceAirPressure(int airPressure) throws TinkerforgeException
TinkerforgeException
public short getChipTemperature() throws TinkerforgeException
TinkerforgeException
public int getReferenceAirPressure() throws TinkerforgeException
setReferenceAirPressure(int)
.TinkerforgeException
public void setAveraging(short movingAveragePressure, short averagePressure, short averageTemperature) throws TinkerforgeException
TinkerforgeException
public BrickletBarometer.Averaging getAveraging() throws TinkerforgeException
setAveraging(short, short, short)
.
.. versionadded:: 2.0.1$nbsp;(Plugin)TinkerforgeException
public void setI2CMode(short mode) throws TinkerforgeException
TinkerforgeException
public short getI2CMode() throws TinkerforgeException
setI2CMode(short)
.
.. versionadded:: 2.0.3$nbsp;(Plugin)TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addAirPressureListener(BrickletBarometer.AirPressureListener listener)
public void removeAirPressureListener(BrickletBarometer.AirPressureListener listener)
public void addAltitudeListener(BrickletBarometer.AltitudeListener listener)
public void removeAltitudeListener(BrickletBarometer.AltitudeListener listener)
public void addAirPressureReachedListener(BrickletBarometer.AirPressureReachedListener listener)
public void removeAirPressureReachedListener(BrickletBarometer.AirPressureReachedListener listener)
public void addAltitudeReachedListener(BrickletBarometer.AltitudeReachedListener listener)
public void removeAltitudeReachedListener(BrickletBarometer.AltitudeReachedListener listener)
Copyright © 2022 Tinkerforge GmbH. All rights reserved.