]> git.basschouten.com Git - openhab-addons.git/blob
2de5e671862ed7ac82e73b5efc7901170030d354
[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.sleepiq.internal.api.dto;
14
15 import com.google.gson.annotations.SerializedName;
16
17 /**
18  * The {@link FoundationFeaturesResponse} holds the features of the foundation
19  * returned from the sleepiq API.
20  *
21  * @author Mark Hilbush - Initial contribution
22  */
23 public class FoundationFeaturesResponse {
24     private static final int BOARD_AS_SINGLE = 0x01;
25     private static final int MASSAGE_AND_LIGHT = 0x02;
26     private static final int FOOT_CONTROL = 0x04;
27     private static final int FOOT_WARMING = 0x08;
28     private static final int UNDER_BED_LIGHT = 0x10;
29
30     @SerializedName("fsBedType")
31     private int bedType;
32
33     @SerializedName("fsBoardFaults")
34     private int boardFaults;
35
36     @SerializedName("fsBoardFeatures")
37     private int boardFeatures;
38
39     @SerializedName("fsBoardHWRevisionCode")
40     private int boardHWRev;
41
42     @SerializedName("fsBoardStatus")
43     private int boardStatus;
44
45     @SerializedName("fsLeftUnderbedLightPWM")
46     private int leftUnderbedLightPWM;
47
48     @SerializedName("fsRightUnderbedLightPWM")
49     private int rightUnderbedLightPWM;
50
51     public int getBedType() {
52         return bedType;
53     }
54
55     public int getBoardFaults() {
56         return boardFaults;
57     }
58
59     public int getBoardFeatures() {
60         return boardFeatures;
61     }
62
63     public boolean isBoardAsSingle() {
64         return (boardFeatures & BOARD_AS_SINGLE) > 0;
65     }
66
67     public boolean hasMassageAndLight() {
68         return (boardFeatures & MASSAGE_AND_LIGHT) > 0;
69     }
70
71     public boolean hasFootControl() {
72         return (boardFeatures & FOOT_CONTROL) > 0;
73     }
74
75     public boolean hasFootWarming() {
76         return (boardFeatures & FOOT_WARMING) > 0;
77     }
78
79     public boolean hasUnderBedLight() {
80         return (boardFeatures & UNDER_BED_LIGHT) > 0;
81     }
82
83     public int getBoardHWRev() {
84         return boardHWRev;
85     }
86
87     public int getBoardStatus() {
88         return boardStatus;
89     }
90
91     public int getLeftUnderbedLightPWM() {
92         return leftUnderbedLightPWM;
93     }
94
95     public int getRightUnderbedLightPWM() {
96         return rightUnderbedLightPWM;
97     }
98
99     @Override
100     public String toString() {
101         StringBuilder builder = new StringBuilder();
102         builder.append("FoundationFeaturesResponse [");
103         builder.append("bedType=");
104         builder.append(bedType);
105         builder.append(", boardFaults=");
106         builder.append(boardFaults);
107         builder.append(", boardFeatures=");
108         builder.append(boardFeatures);
109         builder.append(", boardHWRevisionCode=");
110         builder.append(boardHWRev);
111         builder.append(", boardStatus=");
112         builder.append(boardStatus);
113         builder.append(", leftUnderbedLightPWM=");
114         builder.append(leftUnderbedLightPWM);
115         builder.append(", rightUnderbedLightPWM=");
116         builder.append(rightUnderbedLightPWM);
117         builder.append("]");
118         return builder.toString();
119     }
120 }