]> git.basschouten.com Git - openhab-addons.git/blob
b8fba4788fbaa0b4d1754aef4f9398ff6415f0d1
[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.monopriceaudio.internal.dto;
14
15 /**
16  * Represents the data elements of a single zone of the Monoprice Whole House Amplifier
17  *
18  * @author Michael Lobstein - Initial contribution
19  */
20 public class MonopriceAudioZoneDTO {
21
22     private String zone;
23     private String page;
24     private String power;
25     private String mute;
26     private String dnd;
27     private int volume;
28     private int treble;
29     private int bass;
30     private int balance;
31     private String source;
32     private String keypad;
33
34     public void setZone(String zone) {
35         this.zone = zone;
36     }
37
38     public void setPage(String page) {
39         this.page = page;
40     }
41
42     public String getPage() {
43         return this.page;
44     }
45
46     public boolean isPageActive() {
47         return ("01").equals(this.page);
48     }
49
50     public void setPower(String power) {
51         this.power = power;
52     }
53
54     public String getPower() {
55         return this.power;
56     }
57
58     public boolean isPowerOn() {
59         return ("01").equals(this.power);
60     }
61
62     public void setMute(String mute) {
63         this.mute = mute;
64     }
65
66     public String getMute() {
67         return this.mute;
68     }
69
70     public boolean isMuted() {
71         return ("01").equals(this.mute);
72     }
73
74     public void setDnd(String dnd) {
75         this.dnd = dnd;
76     }
77
78     public String getDnd() {
79         return this.dnd;
80     }
81
82     public boolean isDndOn() {
83         return ("01").equals(this.dnd);
84     }
85
86     public int getVolume() {
87         return this.volume;
88     }
89
90     public void setVolume(int volume) {
91         this.volume = volume;
92     }
93
94     public int getTreble() {
95         return this.treble;
96     }
97
98     public void setTreble(int treble) {
99         this.treble = treble;
100     }
101
102     public int getBass() {
103         return this.bass;
104     }
105
106     public void setBass(int bass) {
107         this.bass = bass;
108     }
109
110     public int getBalance() {
111         return this.balance;
112     }
113
114     public void setBalance(int balance) {
115         this.balance = balance;
116     }
117
118     public String getSource() {
119         return this.source;
120     }
121
122     public void setSource(String source) {
123         this.source = source;
124     }
125
126     public void setKeypad(String keypad) {
127         this.keypad = keypad;
128     }
129
130     public String getKeypad() {
131         return this.keypad;
132     }
133
134     public boolean isKeypadActive() {
135         return ("01").equals(this.keypad);
136     }
137
138     @Override
139     public String toString() {
140         // Re-construct the original status message from the controller
141         // This is used to determine if something changed from the last polling update
142         return zone + page + power + mute + dnd + (String.format("%02d", volume)) + (String.format("%02d", treble))
143                 + (String.format("%02d", bass)) + (String.format("%02d", balance)) + source + keypad;
144     }
145 }