]> git.basschouten.com Git - openhab-addons.git/blob
c9d13a66d2fb82481fb5acbc3168d9cfa2e838a2
[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.dsmr.internal.device.p1telegram;
14
15 import java.util.Collections;
16 import java.util.List;
17 import java.util.Map.Entry;
18
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.dsmr.internal.device.cosem.CosemObject;
21
22 /**
23  * Data class containing a Telegram with CosemObjects and TelegramState and if in lenient mode also the raw telegram
24  * data.
25  *
26  * @author Hilbrand Bouwkamp - Initial contribution
27  */
28 @NonNullByDefault
29 public class P1Telegram {
30
31     /**
32      * The TelegramState described the meta data of the P1Telegram
33      */
34
35     private final List<CosemObject> cosemObjects;
36     private final String rawTelegram;
37     private final List<Entry<String, String>> unknownCosemObjects;
38
39     public P1Telegram(final List<CosemObject> cosemObjects) {
40         this(cosemObjects, "", Collections.emptyList());
41     }
42
43     public P1Telegram(final List<CosemObject> cosemObjects, final String rawTelegram,
44             final List<Entry<String, String>> unknownCosemObjects) {
45         this.cosemObjects = cosemObjects;
46         this.rawTelegram = rawTelegram;
47         this.unknownCosemObjects = unknownCosemObjects;
48     }
49
50     /**
51      * @return The list of CosemObjects
52      */
53     public List<CosemObject> getCosemObjects() {
54         return cosemObjects;
55     }
56
57     /**
58      * @return The raw telegram data.
59      */
60     public String getRawTelegram() {
61         return rawTelegram;
62     }
63
64     /**
65      * @return The list of CosemObject found in the telegram but not known to the binding
66      */
67     public List<Entry<String, String>> getUnknownCosemObjects() {
68         return unknownCosemObjects;
69     }
70 }