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