]> git.basschouten.com Git - openhab-addons.git/blob
8235dd34ba26e2f8424c788813828c3e7dedec83
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2024 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.homewizard.internal;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 import com.google.gson.annotations.SerializedName;
18
19 /**
20  * Class that provides storage for the json object obtained from the HomeWizard device State API
21  *
22  * @author DaniĆ«l van Os - Initial contribution
23  *
24  */
25 @NonNullByDefault
26 public class StatePayload {
27     @SerializedName("power_on")
28     private boolean powerOn;
29     @SerializedName("switch_lock")
30     private boolean switchLock;
31     private int brightness = 0;
32
33     /**
34      * Getter for the power_on field
35      *
36      * @return true if the device is currently on, false if it is off
37      */
38     public boolean getPowerOn() {
39         return powerOn;
40     }
41
42     /**
43      * Setter for the power_on field
44      *
45      * @param powerOn true to turn the device on, false to turn it off
46      */
47     public void setPowerOn(boolean powerOn) {
48         this.powerOn = powerOn;
49     }
50
51     /**
52      * Getter for the switch_lock field
53      *
54      * @return true if the device currently locked, false if it is not
55      */
56     public boolean getSwitchLock() {
57         return switchLock;
58     }
59
60     /**
61      * Setter for the power_on field
62      *
63      * @param switchLock true to lock the device, false to unlock it
64      */
65     public void setSwitchLock(boolean switchLock) {
66         this.switchLock = switchLock;
67     }
68
69     /**
70      * Getter for the ring brightness
71      *
72      * @return ring brightness percentage
73      */
74     public int getBrightness() {
75         return brightness;
76     }
77
78     /**
79      * Setter for the ring brightness
80      *
81      * @param brightness ring brightness
82      */
83     public void setBrightness(int brightness) {
84         this.brightness = brightness;
85     }
86
87     @Override
88     public String toString() {
89         return String.format("State [power_on: %b switch_lock: %b brightness: %d]", powerOn, switchLock, brightness);
90     }
91 }