]> git.basschouten.com Git - openhab-addons.git/blob
286f732eca9371d37555fabc359e5d2d709ea3a0
[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.yamahamusiccast.internal.dto;
14
15 import org.eclipse.jdt.annotation.Nullable;
16
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * This class represents the Status request requested from the Yamaha model/device via the API.
21  *
22  * @author Lennert Coopman - Initial contribution
23  * @author Florian Hotze - Add volume in decibel
24  */
25
26 public class Status {
27
28     @SerializedName("response_code")
29     private String responseCode;
30
31     @SerializedName("power")
32     private String power;
33
34     @SerializedName("mute")
35     private String mute;
36
37     @SerializedName("volume")
38     private int volume;
39
40     @SerializedName("actual_volume")
41     private ActualVolume actualVolume;
42
43     @SerializedName("max_volume")
44     private int maxVolume = 1;
45
46     @SerializedName("input")
47     private String input;
48
49     @SerializedName("sound_program")
50     private String soundProgram;
51
52     @SerializedName("sleep")
53     private int sleep = 0;
54
55     public String getResponseCode() {
56         if (responseCode == null) {
57             responseCode = "";
58         }
59         return responseCode;
60     }
61
62     public String getPower() {
63         if (power == null) {
64             power = "";
65         }
66         return power;
67     }
68
69     public String getMute() {
70         if (mute == null) {
71             mute = "";
72         }
73         return mute;
74     }
75
76     public int getVolume() {
77         return volume;
78     }
79
80     public @Nullable ActualVolume getActualVolume() {
81         return actualVolume;
82     }
83
84     public int getMaxVolume() {
85         // if no value is returned, set to 1 to avoid division by zero
86         if (maxVolume == 0) {
87             maxVolume = 1;
88         }
89         return maxVolume;
90     }
91
92     public String getInput() {
93         if (input == null) {
94             input = "";
95         }
96         return input;
97     }
98
99     public String getSoundProgram() {
100         if (soundProgram == null) {
101             soundProgram = "";
102         }
103         return soundProgram;
104     }
105
106     public int getSleep() {
107         return sleep;
108     }
109 }