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
68 void registerGroupAddressListener(GroupAddressListener listener);
71 * Remove the given listener.
73 * @param listener the listener
75 void unregisterGroupAddressListener(GroupAddressListener listener);
78 * Schedule the given data point for asynchronous reading.
80 * @param datapoint the datapoint
82 void readDatapoint(Datapoint datapoint);
85 * Write a command to the KNX bus.
87 * @param commandSpec the outbound spec
88 * @throws KNXException if any problem with the communication arises.
90 void writeToKNX(OutboundSpec commandSpec) throws KNXException;
93 * Send a state as a read-response to the KNX bus.
95 * @param responseSpec the outbound spec
96 * @throws KNXException if any problem with the communication arises.
98 void respondToKNX(OutboundSpec responseSpec) throws KNXException;