]> git.basschouten.com Git - openhab-addons.git/blob
ab623f8d456035b5c0c695295b360dd330514ab4
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.hdpowerview.internal.api.responses;
14
15 import java.util.Base64;
16 import java.util.List;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.hdpowerview.internal.api.ShadePosition;
21
22 /**
23  * State of all Shades, as returned by an HD PowerView hub
24  *
25  * @author Andy Lintner - Initial contribution
26  */
27 @NonNullByDefault
28 public class Shades {
29
30     public @Nullable List<ShadeData> shadeData;
31     public @Nullable List<Integer> shadeIds;
32
33     /*
34      * the following SuppressWarnings annotation is because the Eclipse compiler
35      * does NOT expect a NonNullByDefault annotation on the inner class, since it is
36      * implicitly inherited from the outer class, whereas the Maven compiler always
37      * requires an explicit NonNullByDefault annotation on all classes
38      */
39     @SuppressWarnings("null")
40     @NonNullByDefault
41     public static class ShadeData {
42         public int id;
43         public @Nullable String name;
44         public int roomId;
45         public int groupId;
46         public int order;
47         public int type;
48         public double batteryStrength;
49         public int batteryStatus;
50         public boolean batteryIsLow;
51         public @Nullable ShadePosition positions;
52         public @Nullable Boolean timedOut;
53         public int signalStrength;
54         public @Nullable Integer capabilities;
55
56         public String getName() {
57             return new String(Base64.getDecoder().decode(name));
58         }
59     }
60 }