2 * Copyright (c) 2010-2022 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.loxone.internal.types;
16 * Reasons why Miniserver may be not reachable
18 * @author Pawel Pieczul - initial contribution
21 public enum LxErrorCode {
27 * User name or password incorrect or user not authorized
31 * Too many failed login attempts and server's temporary ban of the user
33 TOO_MANY_FAILED_LOGIN_ATTEMPTS,
35 * Communication error with the Miniserv
39 * Timeout of user authentication procedure
41 USER_AUTHENTICATION_TIMEOUT,
43 * No activity from Miniserver's client
45 WEBSOCKET_IDLE_TIMEOUT,
47 * Internal error, sign of something wrong with the program
51 * Error code is missing - reason for failure is unknown
56 * Converts Miniserver status code to enumerated error value
58 * @param code status code received in message response from the Miniserver
59 * @return converted error code
61 public static LxErrorCode getErrorCode(Integer code) {
63 return ERROR_CODE_MISSING;
67 return USER_AUTHENTICATION_TIMEOUT;
70 return USER_UNAUTHORIZED;
72 return TOO_MANY_FAILED_LOGIN_ATTEMPTS;
74 return WEBSOCKET_IDLE_TIMEOUT;
78 return COMMUNICATION_ERROR;