]> git.basschouten.com Git - openhab-addons.git/blob
db9c3764606f9cfda648db570e2f527a03efd606
[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.tapocontrol.internal.constants;
14
15 import java.util.Set;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18
19 /**
20  * The {@link TapoErrorConstants} class defines error-message constants
21  *
22  * @author Christian Wild - Initial contribution
23  */
24 @NonNullByDefault
25 public class TapoErrorConstants {
26     /****************************************
27      * LIST OF ERROR CODES
28      ****************************************/
29     // List of API-ErrorCodes
30     public static final Integer ERR_COMMON_FAILED = -1;
31     public static final Integer ERR_SESSION_TIMEOUT = 9999;
32     public static final Integer ERR_NULL_TRANSPORT = 1000;
33     public static final Integer ERR_REQUEST = 1002;
34     public static final Integer ERR_HAND_SHAKE_FAILED = 1100;
35     public static final Integer ERR_LOGIN_FAILED = 1111;
36     public static final Integer ERR_HTTP_TRANSPORT_FAILED = 1112;
37     public static final Integer ERR_MULTI_REQUEST_FAILED = 1200;
38     public static final Integer ERR_JSON_DECODE_FAIL = -1003;
39     public static final Integer ERR_JSON_ENCODE_FAIL = -1004;
40     public static final Integer ERR_AES_DECODE_FAIL = -1005;
41     public static final Integer ERR_REQUEST_LEN_ERROR = -1006;
42     public static final Integer ERR_CLOUD_FAILED = -1007;
43     public static final Integer ERR_PARAMS = -1008;
44     public static final Integer ERR_RSA_KEY_LENGTH = -1010;
45     public static final Integer ERR_SESSION_PARAM = -1101;
46     public static final Integer ERR_QUICK_SETUP = -1201;
47     public static final Integer ERR_DEVICE = -1301;
48     public static final Integer ERR_DEVICE_NEXT_EVENT = -1302;
49     public static final Integer ERR_FIRMWARE = -1401;
50     public static final Integer ERR_FIRMWARE_VER_ERROR = -1402;
51     public static final Integer ERR_LOGIN = -1501;
52     public static final Integer ERR_TIME = -1601;
53     public static final Integer ERR_TIME_SYS = -1602;
54     public static final Integer ERR_TIME_SAVE = -1603;
55     public static final Integer ERR_WIRELESS = -1701;
56     public static final Integer ERR_WIRELESS_UNSUPPORTED = -1702;
57     public static final Integer ERR_SCHEDULE = -1801;
58     public static final Integer ERR_SCHEDULE_FULL = -1802;
59     public static final Integer ERR_SCHEDULE_CONFLICT = -1803;
60     public static final Integer ERR_SCHEDULE_SAVE = -1804;
61     public static final Integer ERR_SCHEDULE_INDEX = -1805;
62     public static final Integer ERR_COUNTDOWN = -1901;
63     public static final Integer ERR_COUNTDOWN_CONFLICT = -1902;
64     public static final Integer ERR_COUNTDOWN_SAVE = -1903;
65     public static final Integer ERR_ANTITHEFT = -2001;
66     public static final Integer ERR_ANTITHEFT_CONFLICT = -2002;
67     public static final Integer ERR_ANTITHEFT_SAVE = -2003;
68     public static final Integer ERR_ACCOUNT = -2101;
69     public static final Integer ERR_STAT = -2201;
70     public static final Integer ERR_STAT_SAVE = -2202;
71     public static final Integer ERR_DST = -2301;
72     public static final Integer ERR_DST_SAVE = -2302;
73     // -20661
74
75     // List of Binding-ErrorCodes
76     public static final Integer ERR_HTTP_RESPONSE = 9001;
77     public static final Integer ERR_COOKIE = 9002;
78     public static final Integer ERR_CREDENTIALS = 9003;
79     public static final Integer ERR_DEVICE_OFFLINE = 9009;
80     public static final Integer ERR_CONNECT_TIMEOUT = 9010;
81
82     // List of Config-ErrorCodes
83     public static final Integer ERR_CONF_IP = 10001; // ip not set
84     public static final Integer ERR_CONF_CREDENTIALS = 10002; // credentials not set
85     public static final Integer ERR_NO_BRIDGE = 10003; // no bridge configured
86
87     /****************************************
88      * LIST OF ERROR MESSAGES
89      ****************************************/
90     // List of CLOUD-Error-Messages
91     public static final String ERR_COMMON_FAILED_MSG = ""; // -1;
92     public static final String ERR_SESSION_TIMEOUT_MSG = "Session Timeout"; // 9999;
93     public static final String ERR_NULL_TRANSPORT_MSG = ""; // 1000;
94     public static final String ERR_REQUEST_MSG = "Invalid request or command"; // 1002;
95     public static final String ERR_HAND_SHAKE_FAILED_MSG = "Can't create handshake"; // 1100;
96     public static final String ERR_LOGIN_FAILED_MSG = ""; // 1111;
97     public static final String ERR_HTTP_TRANSPORT_FAILED_MSG = ""; // 1112;
98     public static final String ERR_MULTI_REQUEST_FAILED_MSG = ""; // 1200;
99     public static final String ERR_JSON_DECODE_FAIL_MSG = "json decode failed"; // -1003;
100     public static final String ERR_JSON_ENCODE_FAIL_MSG = "json encode failed"; // -1004;
101     public static final String ERR_AES_DECODE_FAIL_MSG = ""; // -1005;
102     public static final String ERR_REQUEST_LEN_ERROR_MSG = ""; // -1006;
103     public static final String ERR_CLOUD_FAILED_MSG = ""; // -1007;
104     public static final String ERR_PARAMS_MSG = "received invalid parameter"; // -1008;
105     public static final String ERR_RSA_KEY_LENGTH_MSG = "Invalid Public Key Length"; // -1010;
106     public static final String ERR_SESSION_PARAM_MSG = ""; // -1101;
107     public static final String ERR_QUICK_SETUP_MSG = ""; // -1201;
108     public static final String ERR_DEVICE_MSG = ""; // -1301;
109     public static final String ERR_DEVICE_NEXT_EVENT_MSG = ""; // -1302;
110     public static final String ERR_FIRMWARE_MSG = ""; // -1401;
111     public static final String ERR_FIRMWARE_VER_ERROR_MSG = ""; // -1402;
112     public static final String ERR_LOGIN_MSG = "Login Error"; // -1501;
113     public static final String ERR_TIME_MSG = ""; // -1601;
114     public static final String ERR_TIME_SYS_MSG = ""; // -1602;
115     public static final String ERR_TIME_SAVE_MSG = ""; // -1603;
116     public static final String ERR_WIRELESS_MSG = ""; // -1701;
117     public static final String ERR_WIRELESS_UNSUPPORTED_MSG = ""; // -1702;
118     public static final String ERR_SCHEDULE_MSG = ""; // -1801;
119     public static final String ERR_SCHEDULE_FULL_MSG = ""; // -1802;
120     public static final String ERR_SCHEDULE_CONFLICT_MSG = ""; // -1803;
121     public static final String ERR_SCHEDULE_SAVE_MSG = ""; // -1804;
122     public static final String ERR_SCHEDULE_INDEX_MSG = ""; // -1805;
123     public static final String ERR_COUNTDOWN_MSG = ""; // -1901;
124     public static final String ERR_COUNTDOWN_CONFLICT_MSG = ""; // -1902;
125     public static final String ERR_COUNTDOWN_SAVE_MSG = ""; // -1903;
126     public static final String ERR_ANTITHEFT_MSG = ""; // -2001;
127     public static final String ERR_ANTITHEFT_CONFLICT_MSG = ""; // -2002;
128     public static final String ERR_ANTITHEFT_SAVE_MSG = ""; // -2003;
129     public static final String ERR_ACCOUNT_MSG = ""; // -2101;
130     public static final String ERR_STAT_MSG = ""; // -2201;
131     public static final String ERR_STAT_SAVE_MSG = ""; // -2202;
132     public static final String ERR_DST_MSG = ""; // -2301;
133     public static final String ERR_DST_SAVE_MSG = ""; // -2302;
134
135     // List of Binding-Error-Messages
136     public static final String ERR_HTTP_RESPONSE_MSG = "Invalid HTTP-Response"; // 9001
137     public static final String ERR_COOKIE_MSG = "Cookie Error"; // 9002
138     public static final String ERR_DEVICE_OFFLINE_MSG = "Device Offline"; // 9009
139     public static final String ERR_CREDENTIALS_MSG = "Invalid Request or Credentials";
140     public static final String ERR_CONNECT_TIMEOUT_MSG = "Connection Timeout - device not reachable";
141
142     // List of Config-Error-Messages
143     public static final String ERR_CONF_IP_MSG = "IP-Address not valid"; // 10001;
144     public static final String ERR_CONF_CREDENTIALS_MSG = "credentials not set (bridge)"; // 10002;
145     public static final String ERR_NO_BRIDGE_MSG = "no bridge configured"; // 10003;
146
147     /****************************************
148      * ErrorTypes
149      ****************************************/
150     // communication errors - set device to offline (retry connect)
151     public static final Set<Integer> LIST_COMMUNICATION_ERRORS = Set.of(ERR_HTTP_RESPONSE, ERR_COOKIE,
152             ERR_DEVICE_OFFLINE, ERR_CONNECT_TIMEOUT);
153     // configuration errors - set device to state configuration error (don't retry)
154     public static final Set<Integer> LIST_CONFIGURATION_ERRORS = Set.of(ERR_CREDENTIALS);
155     // reauthenticate errors (trying login immediatly)
156     public static final Set<Integer> LIST_REAUTH_ERRORS = Set.of(ERR_SESSION_TIMEOUT, ERR_HAND_SHAKE_FAILED);
157 }