]> git.basschouten.com Git - openhab-addons.git/blob
4755415e2e85c1a9d841251dcfe81ebb37972872
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.neato.internal.classes;
14
15 /**
16  * The {@link NeatoState} is the internal class for state information from the vacuum cleaner.
17  *
18  * @author Patrik Wimnell - Initial contribution
19  */
20 public class NeatoState {
21
22     private Integer version;
23     private String reqId;
24     private String result;
25     private String error;
26     private RobotInfoData data;
27     private Integer state;
28     private Integer action;
29     private Cleaning cleaning;
30     private Details details;
31     private AvailableCommands availableCommands;
32     private AvailableServices availableServices;
33     private Meta meta;
34
35     public enum RobotState {
36         INVALID(0),
37         IDLE(1),
38         BUSY(2),
39         PAUSED(3),
40         ERROR(4);
41
42         private int value;
43
44         RobotState(int value) {
45             this.value = value;
46         }
47
48         public static RobotState fromValue(int value) {
49             for (RobotState s : RobotState.values()) {
50                 if (s.value == value) {
51                     return s;
52                 }
53             }
54             return INVALID;
55         }
56     }
57
58     public enum RobotAction {
59         INVALID(0),
60         HOUSE_CLEANING(1),
61         SPOT_CLEANING(2),
62         MANUAL_CLEANING(3),
63         DOCKING(4),
64         USER_MENU_ACTIVE(5),
65         SUSPENDED_CLEANING(6),
66         UPDATING(7),
67         COPYING_LOGS(8),
68         RECOVERING_LOCATION(9),
69         IEC_TEST(10),
70         MAP_CLEANING(11),
71         EXPLORING_MAP(12),
72         AQUIRING_MAP_IDS(13),
73         CREATING_MAP(14),
74         SUSPENDED_EXPLORATION(15);
75
76         private int value;
77
78         RobotAction(int value) {
79             this.value = value;
80         }
81
82         public static RobotAction fromValue(int value) {
83             for (RobotAction a : RobotAction.values()) {
84                 if (a.value == value) {
85                     return a;
86                 }
87             }
88             return INVALID;
89         }
90     }
91
92     public Integer getVersion() {
93         return version;
94     }
95
96     public void setVersion(Integer version) {
97         this.version = version;
98     }
99
100     public String getReqId() {
101         return reqId;
102     }
103
104     public void setReqId(String reqId) {
105         this.reqId = reqId;
106     }
107
108     public String getResult() {
109         return result;
110     }
111
112     public void setResult(String result) {
113         this.result = result;
114     }
115
116     public String getError() {
117         return error;
118     }
119
120     public void setError(String error) {
121         this.error = error;
122     }
123
124     public RobotInfoData getData() {
125         return data;
126     }
127
128     public void setData(RobotInfoData data) {
129         this.data = data;
130     }
131
132     public Integer getState() {
133         return state;
134     }
135
136     public RobotState getRobotState() {
137         return RobotState.fromValue(this.state);
138     }
139
140     public void setState(Integer state) {
141         this.state = state;
142     }
143
144     public Integer getAction() {
145         return action;
146     }
147
148     public RobotAction getRobotAction() {
149         return RobotAction.fromValue(this.action);
150     }
151
152     public void setAction(Integer action) {
153         this.action = action;
154     }
155
156     public Cleaning getCleaning() {
157         return cleaning;
158     }
159
160     public void setCleaning(Cleaning cleaning) {
161         this.cleaning = cleaning;
162     }
163
164     public Details getDetails() {
165         return details;
166     }
167
168     public void setDetails(Details details) {
169         this.details = details;
170     }
171
172     public AvailableCommands getAvailableCommands() {
173         return availableCommands;
174     }
175
176     public void setAvailableCommands(AvailableCommands availableCommands) {
177         this.availableCommands = availableCommands;
178     }
179
180     public AvailableServices getAvailableServices() {
181         return availableServices;
182     }
183
184     public void setAvailableServices(AvailableServices availableServices) {
185         this.availableServices = availableServices;
186     }
187
188     public Meta getMeta() {
189         return meta;
190     }
191
192     @Override
193     public String toString() {
194         return "NeatoState{" + "version=" + version + ", reqId='" + reqId + '\'' + ", result='" + result + '\''
195                 + ", error='" + error + '\'' + ", data=" + data + ", state=" + state + ", action=" + action
196                 + ", cleaning=" + cleaning + ", details=" + details + ", availableCommands=" + availableCommands
197                 + ", availableServices=" + availableServices + ", meta=" + meta + '}';
198     }
199
200     public void setMeta(Meta meta) {
201         this.meta = meta;
202     }
203 }