]> git.basschouten.com Git - openhab-addons.git/blob
85e5019f47f6819976d7463fbffe13c3e38edb4d
[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.virtual;
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.HmDevice;
22
23 /**
24  * Describes the methods used for a virtual datapoint. A virtual datapoint is generated datapoint with special
25  * functions.
26  *
27  * @author Gerhard Riegler - Initial contribution
28  */
29 public interface VirtualDatapointHandler {
30
31     /**
32      * Returns the virtual datapoint name.
33      */
34     String getName();
35
36     /**
37      * Adds the virtual datapoint to the device.
38      */
39     void initialize(HmDevice device);
40
41     /**
42      * Returns true, if the virtual datapoint can handle a command for the given datapoint.
43      */
44     boolean canHandleCommand(HmDatapoint dp, Object value);
45
46     /**
47      * Handles the special functionality for the given virtual datapoint.
48      */
49     void handleCommand(VirtualGateway gateway, HmDatapoint dp, HmDatapointConfig dpConfig, Object value)
50             throws IOException, HomematicClientException;
51
52     /**
53      * Returns true, if the virtual datapoint can handle the event for the given datapoint.
54      */
55     boolean canHandleEvent(HmDatapoint dp);
56
57     /**
58      * Handles an event to extract data required for the virtual datapoint.
59      */
60     void handleEvent(VirtualGateway gateway, HmDatapoint dp);
61
62     /**
63      * Returns the virtual datapoint in the given channel.
64      */
65     HmDatapoint getVirtualDatapoint(HmChannel channel);
66 }