]> git.basschouten.com Git - openhab-addons.git/blob
8123aed414b3380992000f4bf706e9865dba6e3f
[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.echonetlite.internal;
14
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16
17 /**
18  * @author Michael Barker - Initial contribution
19  */
20 @NonNullByDefault
21 public enum Esv {
22     SetI(0x60),
23     SetC(0x61),
24     Get(0x62),
25     INF_REQ(0x63),
26     SetMI(0x64),
27     SetMC(0x65),
28     GetM(0x66),
29     INFM_REQ(0x67),
30     AddMI(0x68),
31     AddMC(0x69),
32     DelMI(0x6a),
33     DelMC(0x6b),
34     CheckM(0x6c),
35     AddMSI(0x6d),
36     AddMSC(0x6e),
37     Set_Res(0x71),
38     Get_Res(0x72),
39     INF(0x73),
40     INFC(0x74),
41     SetM_Res(0x75),
42     GetM_Res(0x76),
43     INFM(0x77),
44     INFMC(0x78),
45     AddM_Res(0x79),
46     INFC_Res(0x7a),
47     DelM_Res(0x7b),
48     CheckM_Res(0x7d),
49     INFMC_Res(0x7d),
50     AddMS_Res(0x7e),
51     SetI_SNA(0x50),
52     SetC_SNA(0x51),
53     Get_SNA(0x52),
54     INF_SNA(0x53),
55     SetMI_SNA(0x54),
56     SetMC_SNA(0x55),
57     GetM_SNA(0x56),
58     INFM_SNA(0x57),
59     AddMI_SNA(0x58),
60     AddMC_SNA(0x59),
61     DelMI_SNA(0x5a),
62     DelMC_SNA(0x5b),
63     CheckM_SNA(0x5c),
64     AddMSI_SNA(0x5d),
65     AddMSC_SNA(0x5e),
66     Unknown(0x00);
67
68     private final byte code;
69
70     Esv(int code) {
71         this.code = (byte) (code & 0xFF);
72     }
73
74     public static Esv forCode(byte b) {
75         final Esv[] values = values();
76         for (Esv value : values) {
77             if (value.code == b) {
78                 return value;
79             }
80         }
81
82         throw new IllegalArgumentException("Unable to find Esv for: " + b);
83     }
84
85     public byte code() {
86         return code;
87     }
88 }