public class BrickletDualRelay extends Device
Modifier and Type | Class and Description |
---|---|
class |
BrickletDualRelay.Monoflop |
static interface |
BrickletDualRelay.MonoflopDoneListener
This listener is triggered whenever a monoflop timer reaches 0.
|
class |
BrickletDualRelay.State |
Device.Identity
Modifier and Type | Field and Description |
---|---|
static String |
DEVICE_DISPLAY_NAME |
static int |
DEVICE_IDENTIFIER |
static byte |
FUNCTION_GET_IDENTITY |
static byte |
FUNCTION_GET_MONOFLOP |
static byte |
FUNCTION_GET_STATE |
static byte |
FUNCTION_SET_MONOFLOP |
static byte |
FUNCTION_SET_SELECTED_STATE |
static byte |
FUNCTION_SET_STATE |
Constructor and Description |
---|
BrickletDualRelay(String uid,
IPConnection ipcon)
Creates an object with the unique device ID \c uid.
|
Modifier and Type | Method and Description |
---|---|
void |
addMonoflopDoneListener(BrickletDualRelay.MonoflopDoneListener listener)
Adds a MonoflopDone listener.
|
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.
|
BrickletDualRelay.Monoflop |
getMonoflop(short relay)
Returns (for the given relay) the current state and the time as set by
setMonoflop(short, boolean, long) as well as the remaining time until the state flips. |
BrickletDualRelay.State |
getState()
Returns the state of the relays, *true* means on and *false* means off.
|
void |
removeMonoflopDoneListener(BrickletDualRelay.MonoflopDoneListener listener)
Removes a MonoflopDone listener.
|
void |
setMonoflop(short relay,
boolean state,
long time)
The first parameter can be 1 or 2 (relay 1 or relay 2).
|
void |
setSelectedState(short relay,
boolean state)
Sets the state of the selected relay (1 or 2), *true* means on and *false* means off.
|
void |
setState(boolean relay1,
boolean relay2)
Sets the state of the relays, *true* means on and *false* means off.
|
getAPIVersion, getResponseExpected, setResponseExpected, setResponseExpectedAll
public static final int DEVICE_IDENTIFIER
public static final String DEVICE_DISPLAY_NAME
public static final byte FUNCTION_SET_STATE
public static final byte FUNCTION_GET_STATE
public static final byte FUNCTION_SET_MONOFLOP
public static final byte FUNCTION_GET_MONOFLOP
public static final byte FUNCTION_SET_SELECTED_STATE
public static final byte FUNCTION_GET_IDENTITY
public BrickletDualRelay(String uid, IPConnection ipcon)
public void setState(boolean relay1, boolean relay2) throws TinkerforgeException
getState()
or you
can use setSelectedState(short, boolean)
.
All running monoflop timers will be aborted if this function is called.TinkerforgeException
public BrickletDualRelay.State getState() throws TinkerforgeException
TinkerforgeException
public void setMonoflop(short relay, boolean state, long time) throws TinkerforgeException
TinkerforgeException
public BrickletDualRelay.Monoflop getMonoflop(short relay) throws TinkerforgeException
setMonoflop(short, boolean, long)
as well as the remaining time until the state flips.
If the timer is not running currently, the remaining time will be returned
as 0.TinkerforgeException
public void setSelectedState(short relay, boolean state) throws TinkerforgeException
TinkerforgeException
public Device.Identity getIdentity() throws TinkerforgeException
getIdentity
in class Device
TinkerforgeException
public void addMonoflopDoneListener(BrickletDualRelay.MonoflopDoneListener listener)
public void removeMonoflopDoneListener(BrickletDualRelay.MonoflopDoneListener listener)
Copyright © 2021 Tinkerforge GmbH. All rights reserved.