Class TradfriConnection
java.lang.Object
org.openremote.agent.protocol.tradfri.TradfriConnection
The class that represents the configuration for the IKEA TRÅDFRI connection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.openremote.model.asset.agent.ConnectionStatus
The connection status, the default is disconnectedThe connection status consumers of the IKEA TRÅDFRI connectionprotected final String
The IP address of the gatewayprotected final String
The security code that's needed to connect to the gateway. -
Constructor Summary
ConstructorsConstructorDescriptionTradfriConnection
(String gatewayIp, String securityCode) Construct the TradfriConnection class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addConnectionStatusConsumer
(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Adds a connection status consumer.connect()
Handles the connection.void
controlDevice
(Device device, org.openremote.model.attribute.AttributeEvent event) Method to update the values of the device attributes, based on the values entered in the User Interface.void
Handles the disconnection.protected void
onConnectionStatusChanged
(org.openremote.model.asset.agent.ConnectionStatus connectionStatus) Updates the connection status.void
removeConnectionStatusConsumer
(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Removes the connection status consumer.
-
Field Details
-
connectionStatus
protected org.openremote.model.asset.agent.ConnectionStatus connectionStatusThe connection status, the default is disconnected -
connectionStatusConsumers
protected final List<Consumer<org.openremote.model.asset.agent.ConnectionStatus>> connectionStatusConsumersThe connection status consumers of the IKEA TRÅDFRI connection -
gatewayIp
The IP address of the gateway -
securityCode
The security code that's needed to connect to the gateway.
-
-
Constructor Details
-
TradfriConnection
Construct the TradfriConnection class.- Parameters:
gatewayIp
- the IP address of the gateway.securityCode
- the security code to connect to the gateway.
-
-
Method Details
-
connect
Handles the connection.- Returns:
- the gateway.
-
onConnectionStatusChanged
protected void onConnectionStatusChanged(org.openremote.model.asset.agent.ConnectionStatus connectionStatus) Updates the connection status.- Parameters:
connectionStatus
- the connection status.
-
addConnectionStatusConsumer
public void addConnectionStatusConsumer(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Adds a connection status consumer.- Parameters:
connectionStatusConsumer
- the connection status consumer.
-
disconnect
public void disconnect()Handles the disconnection. -
removeConnectionStatusConsumer
public void removeConnectionStatusConsumer(Consumer<org.openremote.model.asset.agent.ConnectionStatus> connectionStatusConsumer) Removes the connection status consumer.- Parameters:
connectionStatusConsumer
- the connection status consumer.
-
controlDevice
Method to update the values of the device attributes, based on the values entered in the User Interface.- Parameters:
device
- the device to which the update applies.event
- the event representing the update.
-