]> git.basschouten.com Git - openhab-addons.git/blob
b2a1ecb7dead1c7c869050dcfa2d2a21aa7cc02f
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.homematic.internal.communicator;
14
15 import java.io.IOException;
16
17 import org.openhab.binding.homematic.internal.misc.HomematicClientException;
18 import org.openhab.binding.homematic.internal.model.HmChannel;
19 import org.openhab.binding.homematic.internal.model.HmDatapoint;
20 import org.openhab.binding.homematic.internal.model.HmDatapointConfig;
21 import org.openhab.binding.homematic.internal.model.HmDatapointInfo;
22 import org.openhab.binding.homematic.internal.model.HmDevice;
23
24 /**
25  * Describes the methods required for the communication with a Homematic gateway.
26  *
27  * @author Gerhard Riegler - Initial contribution
28  */
29 public interface HomematicGateway {
30
31     /**
32      * Initializes the Homematic gateway and starts the watchdog thread.
33      */
34     public void initialize() throws IOException;
35
36     /**
37      * Disposes the HomematicGateway and stops everything.
38      */
39     public void dispose();
40
41     /**
42      * Returns the cached datapoint.
43      */
44     public HmDatapoint getDatapoint(HmDatapointInfo dpInfo) throws HomematicClientException;
45
46     /**
47      * Returns the cached device.
48      */
49     public HmDevice getDevice(String address) throws HomematicClientException;
50
51     /**
52      * Cancel loading all device metadata.
53      */
54     public void cancelLoadAllDeviceMetadata();
55
56     /**
57      * Loads all device, channel and datapoint metadata from the gateway.
58      */
59     public void loadAllDeviceMetadata() throws IOException;
60
61     /**
62      * Loads all values into the given channel.
63      */
64     public void loadChannelValues(HmChannel channel) throws IOException;
65
66     /**
67      * Loads the value of the given {@link HmDatapoint} from the device.
68      * 
69      * @param dp The HmDatapoint that shall be loaded
70      */
71     public void loadDatapointValue(HmDatapoint dp) throws IOException;
72
73     /**
74      * Reenumerates the set of VALUES datapoints for the given channel.
75      */
76     public void updateChannelValueDatapoints(HmChannel channel) throws IOException;
77
78     /**
79      * Prepares the device for reloading all values from the gateway.
80      */
81     public void triggerDeviceValuesReload(HmDevice device);
82
83     /**
84      * Sends the datapoint to the Homematic gateway or executes virtual datapoints.
85      * 
86      * @param dp The datapoint to send/execute
87      * @param dpConfig The configuration of the datapoint
88      * @param newValue The new value for the datapoint
89      * @param rxMode The rxMode with which the value should be sent to the device
90      *            ({@link HomematicBindingConstants#RX_BURST_MODE "BURST"} for burst mode,
91      *            {@link HomematicBindingConstants#RX_WAKEUP_MODE "WAKEUP"} for wakeup mode, or null for the default
92      *            mode)
93      */
94     public void sendDatapoint(HmDatapoint dp, HmDatapointConfig dpConfig, Object newValue, String rxMode)
95             throws IOException, HomematicClientException;
96
97     /**
98      * Returns the id of the HomematicGateway.
99      */
100     public String getId();
101
102     /**
103      * Set install mode of homematic controller. During install mode the
104      * controller will accept any device (normal mode)
105      * 
106      * @param enable <i>true</i> will start install mode, whereas <i>false</i>
107      *            will stop it
108      * @param seconds specify how long the install mode should last
109      * @throws IOException if RpcClient fails to propagate command
110      */
111     public void setInstallMode(boolean enable, int seconds) throws IOException;
112
113     /**
114      * Get current install mode of homematic contoller
115      * 
116      * @return the current time in seconds that the controller remains in
117      *         <i>install_mode==true</i>, respectively <i>0</i> in case of
118      *         <i>install_mode==false</i>
119      * @throws IOException if RpcClient fails to propagate command
120      */
121     public int getInstallMode() throws IOException;
122
123     /**
124      * Loads all rssi values from the gateway.
125      */
126     public void loadRssiValues() throws IOException;
127
128     /**
129      * Starts the connection and event tracker threads.
130      */
131     public void startWatchdogs();
132
133     /**
134      * Deletes the device from the gateway.
135      *
136      * @param address The address of the device to be deleted
137      * @param reset <i>true</i> will perform a factory reset on the device before deleting it.
138      * @param force <i>true</i> will delete the device even if it is not reachable.
139      * @param defer <i>true</i> will delete the device once it becomes available.
140      */
141     public void deleteDevice(String address, boolean reset, boolean force, boolean defer);
142 }