]> git.basschouten.com Git - openhab-addons.git/blob
4cd1d1b5cb54fad7783900c703d464d5466b3c75
[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.miio.internal.robot;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * List of dockingstation status
19  *
20  * @author David Kumar - Initial contribution
21  */
22 @NonNullByDefault
23 public enum DockStatusType {
24     UNKNOWN(-1, "Unknown"),
25     OK(0, "OK"),
26     ERROR_SUCTION(34, "Suction Error"),
27     ERROR_FRESH_WATER_TANK(38, "Error fresh water tank"),
28     ERROR_FRESH_DIRTY_WATER_TANK(39, "Error dirty water tank"),
29     ERROR_DUST_CONTAINER(46, "Missing dust container/dust bag");
30
31     private final int id;
32     private final String description;
33
34     DockStatusType(int id, String description) {
35         this.id = id;
36         this.description = description;
37     }
38
39     public int getId() {
40         return this.id;
41     }
42
43     public static DockStatusType getType(int value) {
44         byte b;
45         int i;
46         DockStatusType[] arrayOfDockStatusType;
47         for (i = (arrayOfDockStatusType = values()).length, b = 0; b < i;) {
48             DockStatusType st = arrayOfDockStatusType[b];
49             if (st.getId() == value) {
50                 return st;
51             }
52             b++;
53         }
54
55         return UNKNOWN;
56     }
57
58     public String getDescription() {
59         return this.description;
60     }
61
62     @Override
63     public String toString() {
64         return "Status " + Integer.toString(this.id) + ": " + this.description;
65     }
66 }