]> git.basschouten.com Git - openhab-addons.git/blob
a4505a1cd5869a753cef23c7272f561ca17f96b0
[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.km200.internal;
14
15 import java.util.HashMap;
16 import java.util.Map;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20
21 import com.google.gson.JsonObject;
22
23 /**
24  * The KM200CommObject representing a service on a device with its all capabilities
25  *
26  * @author Markus Eckhardt - Initial contribution
27  */
28 @NonNullByDefault
29 public class KM200ServiceObject {
30     private int readable;
31     private int writeable;
32     private int recordable;
33     private int virtual;
34     private boolean updated;
35     private @Nullable String parent;
36     private String fullServiceName;
37     private String serviceType;
38     private @Nullable JsonObject jsonData;
39     private @Nullable Object value;
40     private @Nullable Object valueParameter;
41
42     /* Device services */
43     public Map<String, KM200ServiceObject> serviceTreeMap;
44
45     public KM200ServiceObject(String fullServiceName, String serviceType, int readable, int writeable, int recordable,
46             int virtual, @Nullable String parent) {
47         serviceTreeMap = new HashMap<>();
48         this.fullServiceName = fullServiceName;
49         this.serviceType = serviceType;
50         this.readable = readable;
51         this.writeable = writeable;
52         this.recordable = recordable;
53         this.virtual = virtual;
54         this.parent = parent;
55         updated = false;
56     }
57
58     /* Sets */
59     public void setValue(Object val) {
60         value = val;
61     }
62
63     public void setUpdated(boolean updt) {
64         updated = updt;
65     }
66
67     public void setValueParameter(Object val) {
68         valueParameter = val;
69     }
70
71     public void setJSONData(JsonObject data) {
72         jsonData = data;
73     }
74
75     /* gets */
76     public int getReadable() {
77         return readable;
78     }
79
80     public int getWriteable() {
81         return writeable;
82     }
83
84     public int getRecordable() {
85         return recordable;
86     }
87
88     public String getServiceType() {
89         return serviceType;
90     }
91
92     public String getFullServiceName() {
93         return fullServiceName;
94     }
95
96     public @Nullable Object getValue() {
97         return value;
98     }
99
100     public @Nullable Object getValueParameter() {
101         return valueParameter;
102     }
103
104     public @Nullable String getParent() {
105         return parent;
106     }
107
108     public int getVirtual() {
109         return virtual;
110     }
111
112     public boolean getUpdated() {
113         return updated;
114     }
115
116     public @Nullable JsonObject getJSONData() {
117         return jsonData;
118     }
119 }