]> git.basschouten.com Git - openhab-addons.git/blob
1e44558939fd8c69f6f8ebf9f7c85414caaadb59
[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.max.internal.device;
14
15 /**
16  * This enumeration represents the different message types provided by the MAX! Cube protocol.
17  *
18  * @author Andreas Heil (info@aheil.de) - Initial contribution
19  */
20 public enum DeviceType {
21     Invalid(256),
22     Cube(0),
23     HeatingThermostat(1),
24     HeatingThermostatPlus(2),
25     WallMountedThermostat(3),
26     ShutterContact(4),
27     EcoSwitch(5);
28
29     private final int value;
30
31     private DeviceType(int value) {
32         this.value = value;
33     }
34
35     public int getValue() {
36         return value;
37     }
38
39     public static DeviceType create(int value) {
40         switch (value) {
41             case 0:
42                 return Cube;
43             case 1:
44                 return HeatingThermostat;
45             case 2:
46                 return HeatingThermostatPlus;
47             case 3:
48                 return WallMountedThermostat;
49             case 4:
50                 return ShutterContact;
51             case 5:
52                 return EcoSwitch;
53             default:
54                 return Invalid;
55         }
56     }
57
58     @Override
59     public String toString() {
60         switch (value) {
61             case 0:
62                 return "Cube";
63             case 1:
64                 return "Thermostat";
65             case 2:
66                 return "Thermostat+";
67             case 3:
68                 return "Wallmounted Thermostat";
69             case 4:
70                 return "Shutter Contact";
71             case 5:
72                 return "Eco Switch";
73             default:
74                 return "Invalid";
75         }
76     }
77 }