]> git.basschouten.com Git - openhab-addons.git/blob
6483a72c0deb8ec305c712bf23d14143dd4809ec
[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.api.dto.clip1;
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         String modelid = this.modelid;
71         return modelid != null ? modelid.replaceAll(NORMALIZE_ID_REGEX, "_") : modelid;
72     }
73
74     /**
75      * Set the model ID of the object.
76      */
77     public void setModelID(final String modelId) {
78         this.modelid = modelId;
79     }
80
81     public String getManufacturerName() {
82         return manufacturerName;
83     }
84
85     public void setManufacturerName(String manufacturerName) {
86         this.manufacturerName = manufacturerName;
87     }
88
89     public String getProductName() {
90         return productName;
91     }
92
93     public void setProductName(String productName) {
94         this.productName = productName;
95     }
96
97     /**
98      * Returns the software version of the object.
99      *
100      * @return software version
101      */
102     public @Nullable String getSoftwareVersion() {
103         return swversion;
104     }
105
106     /**
107      * Returns the unique id of the object. The unique is the MAC address of the device with a unique endpoint id in the
108      * form: AA:BB:CC:DD:EE:FF:00:11-XX
109      *
110      * @return the unique id, can be null for some virtual types like the daylight sensor
111      */
112     public @Nullable String getUniqueID() {
113         return uniqueid;
114     }
115
116     /**
117      * Sets the unique id of the object.
118      */
119     public void setUniqueID(final String uniqueid) {
120         this.uniqueid = uniqueid;
121     }
122 }