]> git.basschouten.com Git - openhab-addons.git/blob
0aae94e1d96d5b3adf7db2a20383adf9c8a98197
[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.hue.internal.dto;
14
15 import static org.openhab.binding.hue.internal.HueBindingConstants.NORMALIZE_ID_REGEX;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 import com.google.gson.annotations.SerializedName;
21
22 /**
23  * Detailed information about an object on the Hue Bridge
24  *
25  * @author Samuel Leisering - Initial contribution
26  * @author Christoph Weitkamp - Initial contribution
27  */
28 @NonNullByDefault
29 public class FullHueObject extends HueObject {
30
31     private @NonNullByDefault({}) String type;
32     private @Nullable String modelid;
33     @SerializedName("manufacturername")
34     private @NonNullByDefault({}) String manufacturerName;
35     @SerializedName("productname")
36     private @NonNullByDefault({}) String productName;
37     private @Nullable String swversion;
38     private @Nullable String uniqueid;
39
40     public FullHueObject() {
41         super();
42     }
43
44     /**
45      * Returns the type of the object.
46      *
47      * @return type
48      */
49     public String getType() {
50         return type;
51     }
52
53     /**
54      * Set the type of the object.
55      */
56     public void setType(final String type) {
57         this.type = type;
58     }
59
60     /**
61      * Returns the model ID of the object.
62      *
63      * @return model id
64      */
65     public @Nullable String getModelID() {
66         return modelid;
67     }
68
69     public @Nullable String getNormalizedModelID() {
70         return modelid != null ? modelid.replaceAll(NORMALIZE_ID_REGEX, "_") : modelid;
71     }
72
73     /**
74      * Set the model ID of the object.
75      */
76     public void setModelID(final String modelId) {
77         this.modelid = modelId;
78     }
79
80     public String getManufacturerName() {
81         return manufacturerName;
82     }
83
84     public void setManufacturerName(String manufacturerName) {
85         this.manufacturerName = manufacturerName;
86     }
87
88     public String getProductName() {
89         return productName;
90     }
91
92     public void setProductName(String productName) {
93         this.productName = productName;
94     }
95
96     /**
97      * Returns the software version of the object.
98      *
99      * @return software version
100      */
101     public @Nullable String getSoftwareVersion() {
102         return swversion;
103     }
104
105     /**
106      * Returns the unique id of the object. The unique is the MAC address of the device with a unique endpoint id in the
107      * form: AA:BB:CC:DD:EE:FF:00:11-XX
108      *
109      * @return the unique id, can be null for some virtual types like the daylight sensor
110      */
111     public @Nullable String getUniqueID() {
112         return uniqueid;
113     }
114
115     /**
116      * Sets the unique id of the object.
117      */
118     public void setUniqueID(final String uniqueid) {
119         this.uniqueid = uniqueid;
120     }
121 }