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.channel;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
18 import tuwien.auto.calimero.GroupAddress;
19 import tuwien.auto.calimero.KNXFormatException;
22 * Base class for telegram meta-data
24 * @author Simon Kaufmann - initial contribution and API.
28 public abstract class AbstractSpec {
32 protected AbstractSpec(@Nullable ChannelConfiguration channelConfiguration, String defaultDPT) {
33 if (channelConfiguration != null) {
34 String configuredDPT = channelConfiguration.getDPT();
35 this.dpt = configuredDPT != null ? configuredDPT : defaultDPT;
37 this.dpt = defaultDPT;
42 * Helper method to convert a {@link GroupAddressConfiguration} into a {@link GroupAddress}.
44 * @param ga the group address configuration
45 * @return a group address object
47 protected final GroupAddress toGroupAddress(GroupAddressConfiguration ga) {
49 return new GroupAddress(ga.getGA());
50 } catch (KNXFormatException e) {
51 throw new IllegalArgumentException(e);
56 * Return the data point type.
58 * See {@link org.openhab.binding.knx.internal.client.InboundSpec#getDPT()} and
59 * {@link org.openhab.binding.knx.internal.client.OutboundSpec#getDPT()}.
61 * @return the data point type.
63 public final String getDPT() {