Package com.tinkerforge
Class BrickletPTC
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletPTC
-
public class BrickletPTC extends Device
Reads temperatures from Pt100 und Pt1000 sensors
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BrickletPTC.ResistanceCallbackThreshold
static interface
BrickletPTC.ResistanceListener
This listener is triggered periodically with the period that is set bysetResistanceCallbackPeriod(long)
.static interface
BrickletPTC.ResistanceReachedListener
This listener is triggered when the threshold as set bysetResistanceCallbackThreshold(char, int, int)
is reached.static interface
BrickletPTC.SensorConnectedListener
This listener is triggered periodically according to the configuration set bysetSensorConnectedCallbackConfiguration(boolean)
.class
BrickletPTC.TemperatureCallbackThreshold
static interface
BrickletPTC.TemperatureListener
This listener is triggered periodically with the period that is set bysetTemperatureCallbackPeriod(long)
.static interface
BrickletPTC.TemperatureReachedListener
This listener is triggered when the threshold as set bysetTemperatureCallbackThreshold(char, int, int)
is reached.-
Nested classes/interfaces inherited from class com.tinkerforge.Device
Device.Identity
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description BrickletPTC(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
addResistanceListener(BrickletPTC.ResistanceListener listener)
Adds a Resistance listener.void
addResistanceReachedListener(BrickletPTC.ResistanceReachedListener listener)
Adds a ResistanceReached listener.void
addSensorConnectedListener(BrickletPTC.SensorConnectedListener listener)
Adds a SensorConnected listener.void
addTemperatureListener(BrickletPTC.TemperatureListener listener)
Adds a Temperature listener.void
addTemperatureReachedListener(BrickletPTC.TemperatureReachedListener listener)
Adds a TemperatureReached 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.short
getNoiseRejectionFilter()
Returns the noise rejection filter option as set bysetNoiseRejectionFilter(short)
int
getResistance()
Returns the value as measured by the MAX31865 precision delta-sigma ADC.long
getResistanceCallbackPeriod()
Returns the period as set bysetResistanceCallbackPeriod(long)
.BrickletPTC.ResistanceCallbackThreshold
getResistanceCallbackThreshold()
Returns the threshold as set bysetResistanceCallbackThreshold(char, int, int)
.boolean
getSensorConnectedCallbackConfiguration()
Returns the configuration as set bysetSensorConnectedCallbackConfiguration(boolean)
.int
getTemperature()
Returns the temperature of connected sensor.long
getTemperatureCallbackPeriod()
Returns the period as set bysetTemperatureCallbackPeriod(long)
.BrickletPTC.TemperatureCallbackThreshold
getTemperatureCallbackThreshold()
Returns the threshold as set bysetTemperatureCallbackThreshold(char, int, int)
.short
getWireMode()
Returns the wire mode as set bysetWireMode(short)
boolean
isSensorConnected()
Returns *true* if the sensor is connected correctly.void
removeResistanceListener(BrickletPTC.ResistanceListener listener)
Removes a Resistance listener.void
removeResistanceReachedListener(BrickletPTC.ResistanceReachedListener listener)
Removes a ResistanceReached listener.void
removeSensorConnectedListener(BrickletPTC.SensorConnectedListener listener)
Removes a SensorConnected listener.void
removeTemperatureListener(BrickletPTC.TemperatureListener listener)
Removes a Temperature listener.void
removeTemperatureReachedListener(BrickletPTC.TemperatureReachedListener listener)
Removes a TemperatureReached listener.void
setDebouncePeriod(long debounce)
Sets the period with which the threshold listener *BrickletPTC.TemperatureReachedListener
, *BrickletPTC.ResistanceReachedListener
is triggered, if the threshold *setTemperatureCallbackThreshold(char, int, int)
, *setResistanceCallbackThreshold(char, int, int)
keeps being reached.void
setNoiseRejectionFilter(short filter)
Sets the noise rejection filter to either 50Hz (0) or 60Hz (1).void
setResistanceCallbackPeriod(long period)
Sets the period with which theBrickletPTC.ResistanceListener
listener is triggered periodically.void
setResistanceCallbackThreshold(char option, int min, int max)
Sets the thresholds for theBrickletPTC.ResistanceReachedListener
listener.void
setSensorConnectedCallbackConfiguration(boolean enabled)
If you enable this listener, theBrickletPTC.SensorConnectedListener
listener is triggered every time a Pt sensor is connected/disconnected.void
setTemperatureCallbackPeriod(long period)
Sets the period with which theBrickletPTC.TemperatureListener
listener is triggered periodically.void
setTemperatureCallbackThreshold(char option, int min, int max)
Sets the thresholds for theBrickletPTC.TemperatureReachedListener
listener.void
setWireMode(short mode)
Sets the wire mode of the sensor.-
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_TEMPERATURE
public static final byte FUNCTION_GET_TEMPERATURE
- See Also:
- Constant Field Values
-
FUNCTION_GET_RESISTANCE
public static final byte FUNCTION_GET_RESISTANCE
- See Also:
- Constant Field Values
-
FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_TEMPERATURE_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_TEMPERATURE_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_RESISTANCE_CALLBACK_PERIOD
public static final byte FUNCTION_SET_RESISTANCE_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_RESISTANCE_CALLBACK_PERIOD
public static final byte FUNCTION_GET_RESISTANCE_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_TEMPERATURE_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_TEMPERATURE_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_SET_RESISTANCE_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_RESISTANCE_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_GET_RESISTANCE_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_RESISTANCE_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_SET_NOISE_REJECTION_FILTER
public static final byte FUNCTION_SET_NOISE_REJECTION_FILTER
- See Also:
- Constant Field Values
-
FUNCTION_GET_NOISE_REJECTION_FILTER
public static final byte FUNCTION_GET_NOISE_REJECTION_FILTER
- See Also:
- Constant Field Values
-
FUNCTION_IS_SENSOR_CONNECTED
public static final byte FUNCTION_IS_SENSOR_CONNECTED
- See Also:
- Constant Field Values
-
FUNCTION_SET_WIRE_MODE
public static final byte FUNCTION_SET_WIRE_MODE
- See Also:
- Constant Field Values
-
FUNCTION_GET_WIRE_MODE
public static final byte FUNCTION_GET_WIRE_MODE
- See Also:
- Constant Field Values
-
FUNCTION_SET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION
public static final byte FUNCTION_SET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION
- See Also:
- Constant Field Values
-
FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION
public static final byte FUNCTION_GET_SENSOR_CONNECTED_CALLBACK_CONFIGURATION
- 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
-
FILTER_OPTION_50HZ
public static final short FILTER_OPTION_50HZ
- See Also:
- Constant Field Values
-
FILTER_OPTION_60HZ
public static final short FILTER_OPTION_60HZ
- See Also:
- Constant Field Values
-
WIRE_MODE_2
public static final short WIRE_MODE_2
- See Also:
- Constant Field Values
-
WIRE_MODE_3
public static final short WIRE_MODE_3
- See Also:
- Constant Field Values
-
WIRE_MODE_4
public static final short WIRE_MODE_4
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletPTC
public BrickletPTC(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
-
getTemperature
public int getTemperature() throws TinkerforgeException
Returns the temperature of connected sensor. If you want to get the temperature periodically, it is recommended to use theBrickletPTC.TemperatureListener
listener and set the period withsetTemperatureCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
getResistance
public int getResistance() throws TinkerforgeException
Returns the value as measured by the MAX31865 precision delta-sigma ADC. The value can be converted with the following formulas: * Pt100: resistance = (value * 390) / 32768 * Pt1000: resistance = (value * 3900) / 32768 If you want to get the resistance periodically, it is recommended to use theBrickletPTC.ResistanceListener
listener and set the period withsetResistanceCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setTemperatureCallbackPeriod
public void setTemperatureCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletPTC.TemperatureListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletPTC.TemperatureListener
listener is only triggered if the temperature has changed since the last triggering.- Throws:
TinkerforgeException
-
getTemperatureCallbackPeriod
public long getTemperatureCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetTemperatureCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setResistanceCallbackPeriod
public void setResistanceCallbackPeriod(long period) throws TinkerforgeException
Sets the period with which theBrickletPTC.ResistanceListener
listener is triggered periodically. A value of 0 turns the listener off. TheBrickletPTC.ResistanceListener
listener is only triggered if the resistance has changed since the last triggering.- Throws:
TinkerforgeException
-
getResistanceCallbackPeriod
public long getResistanceCallbackPeriod() throws TinkerforgeException
Returns the period as set bysetResistanceCallbackPeriod(long)
.- Throws:
TinkerforgeException
-
setTemperatureCallbackThreshold
public void setTemperatureCallbackThreshold(char option, int min, int max) throws TinkerforgeException
Sets the thresholds for theBrickletPTC.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)" \endverbatim- Throws:
TinkerforgeException
-
getTemperatureCallbackThreshold
public BrickletPTC.TemperatureCallbackThreshold getTemperatureCallbackThreshold() throws TinkerforgeException
Returns the threshold as set bysetTemperatureCallbackThreshold(char, int, int)
.- Throws:
TinkerforgeException
-
setResistanceCallbackThreshold
public void setResistanceCallbackThreshold(char option, int min, int max) throws TinkerforgeException
Sets the thresholds for theBrickletPTC.ResistanceReachedListener
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)" \endverbatim- Throws:
TinkerforgeException
-
getResistanceCallbackThreshold
public BrickletPTC.ResistanceCallbackThreshold getResistanceCallbackThreshold() throws TinkerforgeException
Returns the threshold as set bysetResistanceCallbackThreshold(char, int, int)
.- Throws:
TinkerforgeException
-
setDebouncePeriod
public void setDebouncePeriod(long debounce) throws TinkerforgeException
Sets the period with which the threshold listener *BrickletPTC.TemperatureReachedListener
, *BrickletPTC.ResistanceReachedListener
is triggered, if the threshold *setTemperatureCallbackThreshold(char, int, int)
, *setResistanceCallbackThreshold(char, int, int)
keeps being reached.- Throws:
TinkerforgeException
-
getDebouncePeriod
public long getDebouncePeriod() throws TinkerforgeException
Returns the debounce period as set bysetDebouncePeriod(long)
.- Throws:
TinkerforgeException
-
setNoiseRejectionFilter
public void setNoiseRejectionFilter(short filter) throws TinkerforgeException
Sets the noise rejection filter to either 50Hz (0) or 60Hz (1). Noise from 50Hz or 60Hz power sources (including harmonics of the AC power's fundamental frequency) is attenuated by 82dB.- Throws:
TinkerforgeException
-
getNoiseRejectionFilter
public short getNoiseRejectionFilter() throws TinkerforgeException
Returns the noise rejection filter option as set bysetNoiseRejectionFilter(short)
- Throws:
TinkerforgeException
-
isSensorConnected
public boolean isSensorConnected() throws TinkerforgeException
Returns *true* if the sensor is connected correctly. If this function returns *false*, there is either no Pt100 or Pt1000 sensor connected, the sensor is connected incorrectly or the sensor itself is faulty.- Throws:
TinkerforgeException
-
setWireMode
public void setWireMode(short mode) throws TinkerforgeException
Sets the wire mode of the sensor. Possible values are 2, 3 and 4 which correspond to 2-, 3- and 4-wire sensors. The value has to match the jumper configuration on the Bricklet.- Throws:
TinkerforgeException
-
getWireMode
public short getWireMode() throws TinkerforgeException
Returns the wire mode as set bysetWireMode(short)
- Throws:
TinkerforgeException
-
setSensorConnectedCallbackConfiguration
public void setSensorConnectedCallbackConfiguration(boolean enabled) throws TinkerforgeException
If you enable this listener, theBrickletPTC.SensorConnectedListener
listener is triggered every time a Pt sensor is connected/disconnected. .. versionadded:: 2.0.2$nbsp;(Plugin)- Throws:
TinkerforgeException
-
getSensorConnectedCallbackConfiguration
public boolean getSensorConnectedCallbackConfiguration() throws TinkerforgeException
Returns the configuration as set bysetSensorConnectedCallbackConfiguration(boolean)
. .. versionadded:: 2.0.2$nbsp;(Plugin)- 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
-
addTemperatureListener
public void addTemperatureListener(BrickletPTC.TemperatureListener listener)
Adds a Temperature listener.
-
removeTemperatureListener
public void removeTemperatureListener(BrickletPTC.TemperatureListener listener)
Removes a Temperature listener.
-
addTemperatureReachedListener
public void addTemperatureReachedListener(BrickletPTC.TemperatureReachedListener listener)
Adds a TemperatureReached listener.
-
removeTemperatureReachedListener
public void removeTemperatureReachedListener(BrickletPTC.TemperatureReachedListener listener)
Removes a TemperatureReached listener.
-
addResistanceListener
public void addResistanceListener(BrickletPTC.ResistanceListener listener)
Adds a Resistance listener.
-
removeResistanceListener
public void removeResistanceListener(BrickletPTC.ResistanceListener listener)
Removes a Resistance listener.
-
addResistanceReachedListener
public void addResistanceReachedListener(BrickletPTC.ResistanceReachedListener listener)
Adds a ResistanceReached listener.
-
removeResistanceReachedListener
public void removeResistanceReachedListener(BrickletPTC.ResistanceReachedListener listener)
Removes a ResistanceReached listener.
-
addSensorConnectedListener
public void addSensorConnectedListener(BrickletPTC.SensorConnectedListener listener)
Adds a SensorConnected listener.
-
removeSensorConnectedListener
public void removeSensorConnectedListener(BrickletPTC.SensorConnectedListener listener)
Removes a SensorConnected listener.
-
-