2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.knx.internal.client;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.openhab.binding.knx.internal.handler.GroupAddressListener;
19 import tuwien.auto.calimero.IndividualAddress;
20 import tuwien.auto.calimero.KNXException;
21 import tuwien.auto.calimero.datapoint.Datapoint;
24 * Client for communicating with the KNX bus.
26 * @author Simon Kaufmann - initial contribution and API
30 public interface KNXClient {
33 * Check whether the client is connected
35 * @return {@code true} if the client currently is connected
37 boolean isConnected();
40 * Determines whether the supplied address is occupied by a device in the KNX network or not.
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
46 boolean isReachable(@Nullable IndividualAddress address) throws KNXException;
49 * Get the {@link DeviceInfoClient} which allows further device inspection.
51 * @return the device infor client
52 * @throws IllegalStateException in case the client is not connected
54 DeviceInfoClient getDeviceInfoClient();
57 * Initiates a basic restart of the device with the given address.
59 * @param address the individual address of the device
61 void restartNetworkDevice(@Nullable IndividualAddress address);
64 * Register the given listener to be informed on KNX bus traffic.
66 * @param listener the listener
67 * @return {@code true} if it wasn't registered before
69 boolean registerGroupAddressListener(GroupAddressListener listener);
72 * Remove the given listener.
74 * @param listener the listener
75 * @return {@code true} if it was successfully removed
77 boolean unregisterGroupAddressListener(GroupAddressListener listener);
80 * Schedule the given data point for asynchronous reading.
82 * @param datapoint the datapoint
84 void readDatapoint(Datapoint datapoint);
87 * Write a command to the KNX bus.
89 * @param commandSpec the outbound spec
90 * @throws KNXException if any problem with the communication arises.
92 void writeToKNX(OutboundSpec commandSpec) throws KNXException;
95 * Send a state as a read-response to the KNX bus.
97 * @param responseSpec the outbound spec
98 * @throws KNXException if any problem with the communication arises.
100 void respondToKNX(OutboundSpec responseSpec) throws KNXException;