2 * Copyright (c) 2010-2022 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;
17 import org.openhab.binding.knx.internal.client.InboundSpec;
18 import org.openhab.binding.knx.internal.client.OutboundSpec;
20 import tuwien.auto.calimero.GroupAddress;
21 import tuwien.auto.calimero.KNXFormatException;
24 * Base class for telegram meta-data
26 * @author Simon Kaufmann - initial contribution and API.
30 public abstract class AbstractSpec {
34 protected AbstractSpec(@Nullable ChannelConfiguration channelConfiguration, String defaultDPT) {
35 if (channelConfiguration != null) {
36 String configuredDPT = channelConfiguration.getDPT();
37 this.dpt = configuredDPT != null ? configuredDPT : defaultDPT;
39 this.dpt = defaultDPT;
44 * Helper method to convert a {@link GroupAddressConfiguration} into a {@link GroupAddress}.
46 * @param ga the group address configuration
47 * @return a group address object
49 protected final GroupAddress toGroupAddress(GroupAddressConfiguration ga) {
51 return new GroupAddress(ga.getGA());
52 } catch (KNXFormatException e) {
53 throw new IllegalArgumentException(e);
58 * Return the data point type.
60 * See {@link InboundSpec#getDPT()} and {@link OutboundSpec#getDPT()}.
62 * @return the data point type.
64 public final String getDPT() {