]> git.basschouten.com Git - openhab-addons.git/blob
c54991c902a31a84c9e2afffa5621ca8923c34ab
[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.knx.internal.client;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.knx.internal.handler.GroupAddressListener;
18
19 import tuwien.auto.calimero.IndividualAddress;
20 import tuwien.auto.calimero.KNXException;
21 import tuwien.auto.calimero.datapoint.Datapoint;
22
23 /**
24  * Client for communicating with the KNX bus.
25  *
26  * @author Simon Kaufmann - initial contribution and API
27  *
28  */
29 @NonNullByDefault
30 public interface KNXClient {
31
32     /**
33      * Check whether the client is connected
34      *
35      * @return {@code true} if the client currently is connected
36      */
37     boolean isConnected();
38
39     /**
40      * Determines whether the supplied address is occupied by a device in the KNX network or not.
41      *
42      * @param address the individual address to check
43      * @return {@code true} if the address is occupied
44      * @throws KNXException on network or send errors
45      */
46     boolean isReachable(@Nullable IndividualAddress address) throws KNXException;
47
48     /**
49      * Get the {@link DeviceInfoClient} which allows further device inspection.
50      *
51      * @return the device infor client
52      * @throws IllegalStateException in case the client is not connected
53      */
54     DeviceInfoClient getDeviceInfoClient();
55
56     /**
57      * Initiates a basic restart of the device with the given address.
58      *
59      * @param address the individual address of the device
60      */
61     void restartNetworkDevice(@Nullable IndividualAddress address);
62
63     /**
64      * Register the given listener to be informed on KNX bus traffic.
65      *
66      * @param listener the listener
67      */
68     void registerGroupAddressListener(GroupAddressListener listener);
69
70     /**
71      * Remove the given listener.
72      *
73      * @param listener the listener
74      */
75     void unregisterGroupAddressListener(GroupAddressListener listener);
76
77     /**
78      * Schedule the given data point for asynchronous reading.
79      *
80      * @param datapoint the datapoint
81      */
82     void readDatapoint(Datapoint datapoint);
83
84     /**
85      * Write a command to the KNX bus.
86      *
87      * @param commandSpec the outbound spec
88      * @throws KNXException if any problem with the communication arises.
89      */
90     void writeToKNX(OutboundSpec commandSpec) throws KNXException;
91
92     /**
93      * Send a state as a read-response to the KNX bus.
94      *
95      * @param responseSpec the outbound spec
96      * @throws KNXException if any problem with the communication arises.
97      */
98     void respondToKNX(OutboundSpec responseSpec) throws KNXException;
99 }