Package com.tinkerforge
Class BrickletIndustrialDual020mA
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletIndustrialDual020mA
-
public class BrickletIndustrialDual020mA extends Device
Measures two DC currents between 0mA and 20mA (IEC 60381-1)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
BrickletIndustrialDual020mA.CurrentCallbackThreshold
static interface
BrickletIndustrialDual020mA.CurrentListener
This listener is triggered periodically with the period that is set bysetCurrentCallbackPeriod(short, long)
.static interface
BrickletIndustrialDual020mA.CurrentReachedListener
This listener is triggered when the threshold as set bysetCurrentCallbackThreshold(short, 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_CURRENT
static byte
FUNCTION_GET_CURRENT_CALLBACK_PERIOD
static byte
FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD
static byte
FUNCTION_GET_DEBOUNCE_PERIOD
static byte
FUNCTION_GET_IDENTITY
static byte
FUNCTION_GET_SAMPLE_RATE
static byte
FUNCTION_SET_CURRENT_CALLBACK_PERIOD
static byte
FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD
static byte
FUNCTION_SET_DEBOUNCE_PERIOD
static byte
FUNCTION_SET_SAMPLE_RATE
static short
SAMPLE_RATE_15_SPS
static short
SAMPLE_RATE_240_SPS
static short
SAMPLE_RATE_4_SPS
static short
SAMPLE_RATE_60_SPS
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 BrickletIndustrialDual020mA(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
addCurrentListener(BrickletIndustrialDual020mA.CurrentListener listener)
Adds a Current listener.void
addCurrentReachedListener(BrickletIndustrialDual020mA.CurrentReachedListener listener)
Adds a CurrentReached listener.int
getCurrent(short sensor)
Returns the current of the specified sensor.long
getCurrentCallbackPeriod(short sensor)
Returns the period as set bysetCurrentCallbackPeriod(short, long)
.BrickletIndustrialDual020mA.CurrentCallbackThreshold
getCurrentCallbackThreshold(short sensor)
Returns the threshold as set bysetCurrentCallbackThreshold(short, 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.short
getSampleRate()
Returns the sample rate as set bysetSampleRate(short)
.void
removeCurrentListener(BrickletIndustrialDual020mA.CurrentListener listener)
Removes a Current listener.void
removeCurrentReachedListener(BrickletIndustrialDual020mA.CurrentReachedListener listener)
Removes a CurrentReached listener.void
setCurrentCallbackPeriod(short sensor, long period)
Sets the period with which theBrickletIndustrialDual020mA.CurrentListener
listener is triggered periodically for the given sensor.void
setCurrentCallbackThreshold(short sensor, char option, int min, int max)
Sets the thresholds for theBrickletIndustrialDual020mA.CurrentReachedListener
listener for the given sensor.void
setDebouncePeriod(long debounce)
Sets the period with which the threshold listener *BrickletIndustrialDual020mA.CurrentReachedListener
is triggered, if the threshold *setCurrentCallbackThreshold(short, char, int, int)
keeps being reached.void
setSampleRate(short rate)
Sets the sample rate to either 240, 60, 15 or 4 samples per second.-
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_CURRENT
public static final byte FUNCTION_GET_CURRENT
- See Also:
- Constant Field Values
-
FUNCTION_SET_CURRENT_CALLBACK_PERIOD
public static final byte FUNCTION_SET_CURRENT_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_GET_CURRENT_CALLBACK_PERIOD
public static final byte FUNCTION_GET_CURRENT_CALLBACK_PERIOD
- See Also:
- Constant Field Values
-
FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD
public static final byte FUNCTION_SET_CURRENT_CALLBACK_THRESHOLD
- See Also:
- Constant Field Values
-
FUNCTION_GET_CURRENT_CALLBACK_THRESHOLD
public static final byte FUNCTION_GET_CURRENT_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_SAMPLE_RATE
public static final byte FUNCTION_SET_SAMPLE_RATE
- See Also:
- Constant Field Values
-
FUNCTION_GET_SAMPLE_RATE
public static final byte FUNCTION_GET_SAMPLE_RATE
- 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
-
SAMPLE_RATE_240_SPS
public static final short SAMPLE_RATE_240_SPS
- See Also:
- Constant Field Values
-
SAMPLE_RATE_60_SPS
public static final short SAMPLE_RATE_60_SPS
- See Also:
- Constant Field Values
-
SAMPLE_RATE_15_SPS
public static final short SAMPLE_RATE_15_SPS
- See Also:
- Constant Field Values
-
SAMPLE_RATE_4_SPS
public static final short SAMPLE_RATE_4_SPS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletIndustrialDual020mA
public BrickletIndustrialDual020mA(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
-
getCurrent
public int getCurrent(short sensor) throws TinkerforgeException
Returns the current of the specified sensor. It is possible to detect if an IEC 60381-1 compatible sensor is connected and if it works properly. If the returned current is below 4mA, there is likely no sensor connected or the sensor may be defect. If the returned current is over 20mA, there might be a short circuit or the sensor may be defect. If you want to get the current periodically, it is recommended to use theBrickletIndustrialDual020mA.CurrentListener
listener and set the period withsetCurrentCallbackPeriod(short, long)
.- Throws:
TinkerforgeException
-
setCurrentCallbackPeriod
public void setCurrentCallbackPeriod(short sensor, long period) throws TinkerforgeException
Sets the period with which theBrickletIndustrialDual020mA.CurrentListener
listener is triggered periodically for the given sensor. A value of 0 turns the listener off. TheBrickletIndustrialDual020mA.CurrentListener
listener is only triggered if the current has changed since the last triggering.- Throws:
TinkerforgeException
-
getCurrentCallbackPeriod
public long getCurrentCallbackPeriod(short sensor) throws TinkerforgeException
Returns the period as set bysetCurrentCallbackPeriod(short, long)
.- Throws:
TinkerforgeException
-
setCurrentCallbackThreshold
public void setCurrentCallbackThreshold(short sensor, char option, int min, int max) throws TinkerforgeException
Sets the thresholds for theBrickletIndustrialDual020mA.CurrentReachedListener
listener for the given sensor. The following options are possible: \verbatim "Option", "Description" "'x'", "Listener is turned off" "'o'", "Listener is triggered when the current is *outside* the min and max values" "'i'", "Listener is triggered when the current is *inside* the min and max values" "'<'", "Listener is triggered when the current is smaller than the min value (max is ignored)" "'>'", "Listener is triggered when the current is greater than the min value (max is ignored)" \endverbatim- Throws:
TinkerforgeException
-
getCurrentCallbackThreshold
public BrickletIndustrialDual020mA.CurrentCallbackThreshold getCurrentCallbackThreshold(short sensor) throws TinkerforgeException
Returns the threshold as set bysetCurrentCallbackThreshold(short, char, int, int)
.- Throws:
TinkerforgeException
-
setDebouncePeriod
public void setDebouncePeriod(long debounce) throws TinkerforgeException
Sets the period with which the threshold listener *BrickletIndustrialDual020mA.CurrentReachedListener
is triggered, if the threshold *setCurrentCallbackThreshold(short, char, int, int)
keeps being reached.- Throws:
TinkerforgeException
-
getDebouncePeriod
public long getDebouncePeriod() throws TinkerforgeException
Returns the debounce period as set bysetDebouncePeriod(long)
.- Throws:
TinkerforgeException
-
setSampleRate
public void setSampleRate(short rate) throws TinkerforgeException
Sets the sample rate to either 240, 60, 15 or 4 samples per second. The resolution for the rates is 12, 14, 16 and 18 bit respectively. \verbatim "Value", "Description" "0", "240 samples per second, 12 bit resolution" "1", "60 samples per second, 14 bit resolution" "2", "15 samples per second, 16 bit resolution" "3", "4 samples per second, 18 bit resolution" \endverbatim- Throws:
TinkerforgeException
-
getSampleRate
public short getSampleRate() throws TinkerforgeException
Returns the sample rate as set bysetSampleRate(short)
.- 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
-
addCurrentListener
public void addCurrentListener(BrickletIndustrialDual020mA.CurrentListener listener)
Adds a Current listener.
-
removeCurrentListener
public void removeCurrentListener(BrickletIndustrialDual020mA.CurrentListener listener)
Removes a Current listener.
-
addCurrentReachedListener
public void addCurrentReachedListener(BrickletIndustrialDual020mA.CurrentReachedListener listener)
Adds a CurrentReached listener.
-
removeCurrentReachedListener
public void removeCurrentReachedListener(BrickletIndustrialDual020mA.CurrentReachedListener listener)
Removes a CurrentReached listener.
-
-