2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.sleepiq.internal.api.dto;
15 import com.google.gson.annotations.SerializedName;
18 * The {@link FoundationFeaturesResponse} holds the features of the foundation
19 * returned from the sleepiq API.
21 * @author Mark Hilbush - Initial contribution
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;
30 @SerializedName("fsBedType")
33 @SerializedName("fsBoardFaults")
34 private int boardFaults;
36 @SerializedName("fsBoardFeatures")
37 private int boardFeatures;
39 @SerializedName("fsBoardHWRevisionCode")
40 private int boardHWRev;
42 @SerializedName("fsBoardStatus")
43 private int boardStatus;
45 @SerializedName("fsLeftUnderbedLightPWM")
46 private int leftUnderbedLightPWM;
48 @SerializedName("fsRightUnderbedLightPWM")
49 private int rightUnderbedLightPWM;
51 public int getBedType() {
55 public int getBoardFaults() {
59 public int getBoardFeatures() {
63 public boolean isBoardAsSingle() {
64 return (boardFeatures & BOARD_AS_SINGLE) > 0;
67 public boolean hasMassageAndLight() {
68 return (boardFeatures & MASSAGE_AND_LIGHT) > 0;
71 public boolean hasFootControl() {
72 return (boardFeatures & FOOT_CONTROL) > 0;
75 public boolean hasFootWarming() {
76 return (boardFeatures & FOOT_WARMING) > 0;
79 public boolean hasUnderBedLight() {
80 return (boardFeatures & UNDER_BED_LIGHT) > 0;
83 public int getBoardHWRev() {
87 public int getBoardStatus() {
91 public int getLeftUnderbedLightPWM() {
92 return leftUnderbedLightPWM;
95 public int getRightUnderbedLightPWM() {
96 return rightUnderbedLightPWM;
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);
118 return builder.toString();