]> git.basschouten.com Git - openhab-addons.git/blob
e3f8d31abc85aeb2932670826003616652234779
[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.channel;
14
15 import static java.util.stream.Collectors.toList;
16
17 import java.util.Collections;
18 import java.util.List;
19
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.binding.knx.internal.client.InboundSpec;
23
24 import tuwien.auto.calimero.GroupAddress;
25
26 /**
27  * Read meta-data.
28  *
29  * @author Simon Kaufmann - initial contribution and API.
30  *
31  */
32 @NonNullByDefault
33 public class ReadRequestSpecImpl extends AbstractSpec implements InboundSpec {
34
35     private final List<GroupAddress> readAddresses;
36
37     public ReadRequestSpecImpl(@Nullable ChannelConfiguration channelConfiguration, String defaultDPT) {
38         super(channelConfiguration, defaultDPT);
39         if (channelConfiguration != null) {
40             this.readAddresses = channelConfiguration.getReadGAs().stream().map(this::toGroupAddress).collect(toList());
41         } else {
42             this.readAddresses = Collections.emptyList();
43         }
44     }
45
46     @Override
47     public List<GroupAddress> getGroupAddresses() {
48         return readAddresses;
49     }
50 }