]> git.basschouten.com Git - openhab-addons.git/blob
c749a6a41e79f57246fb0f62ffdf8e792686674d
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2021 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.bluetooth.daikinmadoka.internal.model;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * This class contains the enums for the various modes supported by the BLE thermostat
19  *
20  * @author Benjamin Lafois - Initial contribution
21  *
22  */
23 @NonNullByDefault
24 public class MadokaProperties {
25
26     public enum FanSpeed {
27         MAX(5),
28         MEDIUM(3),
29         LOW(1);
30
31         private int v;
32
33         FanSpeed(int v) {
34             this.v = v;
35         }
36
37         public static FanSpeed valueOf(int v) {
38             if (v == 5) {
39                 return MAX;
40             } else if (v >= 2 && v <= 4) {
41                 return MEDIUM;
42             } else {
43                 return LOW;
44             }
45         }
46
47         public int value() {
48             return v;
49         }
50     }
51
52     public enum OperationMode {
53         FAN(0),
54         DRY(1),
55         AUTO(2),
56         COOL(3),
57         HEAT(4),
58         VENTILATION(5);
59
60         private int v;
61
62         OperationMode(int v) {
63             this.v = v;
64         }
65
66         public static OperationMode valueOf(int v) {
67             for (OperationMode m : values()) {
68                 if (m.v == v) {
69                     return m;
70                 }
71             }
72             // Should never happen
73             return HEAT;
74         }
75
76         public int value() {
77             return v;
78         }
79     }
80 }