]> git.basschouten.com Git - openhab-addons.git/blob
6ec71408dfd6ff3f0393cd624baf14794a828a09
[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.loxone.internal.types;
14
15 /**
16  * Types of security authentication/encryption methods.
17  *
18  * @author Pawel Pieczul - initial contribution
19  *
20  */
21 public enum LxWsSecurityType {
22     /**
23      * Method will be determined base on Miniserver software version
24      */
25     AUTO,
26     /**
27      * Hash-based authentication with no command encryption
28      */
29     HASH,
30     /**
31      * Token-based authentication with AES-256 command encryption
32      */
33     TOKEN;
34
35     /**
36      * Encode security type based on index
37      *
38      * @param index
39      *            0 for auto, 1 for hash, 2 for token
40      * @return
41      *         security type fo given index
42      */
43     public static LxWsSecurityType getType(int index) {
44         switch (index) {
45             case 0:
46                 return AUTO;
47             case 1:
48                 return HASH;
49             default:
50             case 2:
51                 return TOKEN;
52         }
53     }
54 }