Package com.tinkerforge
Class BrickletRemoteSwitch
- java.lang.Object
-
- com.tinkerforge.DeviceBase
-
- com.tinkerforge.Device
-
- com.tinkerforge.BrickletRemoteSwitch
-
public class BrickletRemoteSwitch extends Device
Controls remote mains switches
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BrickletRemoteSwitch.SwitchingDoneListener
This listener is triggered whenever the switching state changes from busy to ready, seegetSwitchingState()
.-
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_DIM_SOCKET_B
static byte
FUNCTION_GET_IDENTITY
static byte
FUNCTION_GET_REPEATS
static byte
FUNCTION_GET_SWITCHING_STATE
static byte
FUNCTION_SET_REPEATS
static byte
FUNCTION_SWITCH_SOCKET
static byte
FUNCTION_SWITCH_SOCKET_A
static byte
FUNCTION_SWITCH_SOCKET_B
static byte
FUNCTION_SWITCH_SOCKET_C
static short
SWITCH_TO_OFF
static short
SWITCH_TO_ON
static short
SWITCHING_STATE_BUSY
static short
SWITCHING_STATE_READY
-
Constructor Summary
Constructors Constructor Description BrickletRemoteSwitch(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
addSwitchingDoneListener(BrickletRemoteSwitch.SwitchingDoneListener listener)
Adds a SwitchingDone listener.void
dimSocketB(long address, short unit, short dimValue)
To control a type B dimmer you have to give the address, unit and the dim value you want to set the dimmer to.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
getRepeats()
Returns the number of repeats as set bysetRepeats(short)
.short
getSwitchingState()
Returns the current switching state.void
removeSwitchingDoneListener(BrickletRemoteSwitch.SwitchingDoneListener listener)
Removes a SwitchingDone listener.void
setRepeats(short repeats)
Sets the number of times the code is sent when one of the switch socket functions is called.void
switchSocket(short houseCode, short receiverCode, short switchTo)
This function is deprecated, useswitchSocketA(short, short, short)
instead.void
switchSocketA(short houseCode, short receiverCode, short switchTo)
To switch a type A socket you have to give the house code, receiver code and the state (on or off) you want to switch to.void
switchSocketB(long address, short unit, short switchTo)
To switch a type B socket you have to give the address, unit and the state (on or off) you want to switch to.void
switchSocketC(char systemCode, short deviceCode, short switchTo)
To switch a type C socket you have to give the system code, device code and the state (on or off) you want to switch to.-
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_SWITCH_SOCKET
public static final byte FUNCTION_SWITCH_SOCKET
- See Also:
- Constant Field Values
-
FUNCTION_GET_SWITCHING_STATE
public static final byte FUNCTION_GET_SWITCHING_STATE
- See Also:
- Constant Field Values
-
FUNCTION_SET_REPEATS
public static final byte FUNCTION_SET_REPEATS
- See Also:
- Constant Field Values
-
FUNCTION_GET_REPEATS
public static final byte FUNCTION_GET_REPEATS
- See Also:
- Constant Field Values
-
FUNCTION_SWITCH_SOCKET_A
public static final byte FUNCTION_SWITCH_SOCKET_A
- See Also:
- Constant Field Values
-
FUNCTION_SWITCH_SOCKET_B
public static final byte FUNCTION_SWITCH_SOCKET_B
- See Also:
- Constant Field Values
-
FUNCTION_DIM_SOCKET_B
public static final byte FUNCTION_DIM_SOCKET_B
- See Also:
- Constant Field Values
-
FUNCTION_SWITCH_SOCKET_C
public static final byte FUNCTION_SWITCH_SOCKET_C
- See Also:
- Constant Field Values
-
FUNCTION_GET_IDENTITY
public static final byte FUNCTION_GET_IDENTITY
- See Also:
- Constant Field Values
-
SWITCH_TO_OFF
public static final short SWITCH_TO_OFF
- See Also:
- Constant Field Values
-
SWITCH_TO_ON
public static final short SWITCH_TO_ON
- See Also:
- Constant Field Values
-
SWITCHING_STATE_READY
public static final short SWITCHING_STATE_READY
- See Also:
- Constant Field Values
-
SWITCHING_STATE_BUSY
public static final short SWITCHING_STATE_BUSY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BrickletRemoteSwitch
public BrickletRemoteSwitch(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
-
switchSocket
public void switchSocket(short houseCode, short receiverCode, short switchTo) throws TinkerforgeException
This function is deprecated, useswitchSocketA(short, short, short)
instead.- Throws:
TinkerforgeException
-
getSwitchingState
public short getSwitchingState() throws TinkerforgeException
Returns the current switching state. If the current state is busy, the Bricklet is currently sending a code to switch a socket. It will not accept any requests to switch sockets until the state changes to ready. How long the switching takes is dependent on the number of repeats, seesetRepeats(short)
.- Throws:
TinkerforgeException
-
setRepeats
public void setRepeats(short repeats) throws TinkerforgeException
Sets the number of times the code is sent when one of the switch socket functions is called. The repeats basically correspond to the amount of time that a button of the remote is pressed. Some dimmers are controlled by the length of a button pressed, this can be simulated by increasing the repeats.- Throws:
TinkerforgeException
-
getRepeats
public short getRepeats() throws TinkerforgeException
Returns the number of repeats as set bysetRepeats(short)
.- Throws:
TinkerforgeException
-
switchSocketA
public void switchSocketA(short houseCode, short receiverCode, short switchTo) throws TinkerforgeException
To switch a type A socket you have to give the house code, receiver code and the state (on or off) you want to switch to. A detailed description on how you can figure out the house and receiver code can be found :ref:`here <remote_switch_bricklet_type_a_house_and_receiver_code>`. .. versionadded:: 2.0.1$nbsp;(Plugin)- Throws:
TinkerforgeException
-
switchSocketB
public void switchSocketB(long address, short unit, short switchTo) throws TinkerforgeException
To switch a type B socket you have to give the address, unit and the state (on or off) you want to switch to. To switch all devices with the same address use 255 for the unit. A detailed description on how you can teach a socket the address and unit can be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`. .. versionadded:: 2.0.1$nbsp;(Plugin)- Throws:
TinkerforgeException
-
dimSocketB
public void dimSocketB(long address, short unit, short dimValue) throws TinkerforgeException
To control a type B dimmer you have to give the address, unit and the dim value you want to set the dimmer to. A detailed description on how you can teach a dimmer the address and unit can be found :ref:`here <remote_switch_bricklet_type_b_address_and_unit>`. .. versionadded:: 2.0.1$nbsp;(Plugin)- Throws:
TinkerforgeException
-
switchSocketC
public void switchSocketC(char systemCode, short deviceCode, short switchTo) throws TinkerforgeException
To switch a type C socket you have to give the system code, device code and the state (on or off) you want to switch to. A detailed description on how you can figure out the system and device code can be found :ref:`here <remote_switch_bricklet_type_c_system_and_device_code>`. .. versionadded:: 2.0.1$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
-
addSwitchingDoneListener
public void addSwitchingDoneListener(BrickletRemoteSwitch.SwitchingDoneListener listener)
Adds a SwitchingDone listener.
-
removeSwitchingDoneListener
public void removeSwitchingDoneListener(BrickletRemoteSwitch.SwitchingDoneListener listener)
Removes a SwitchingDone listener.
-
-