Merge remote-tracking branch 'origin/extended-easysetup'
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / android / EasySetupCore / src / main / java / org / iotivity / service / easysetup / mediator / enums / WIFI_MODE.java
1 /**
2  * ***************************************************************
3  *
4  * Copyright 2016 Samsung Electronics All Rights Reserved.
5  *
6  *
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * ****************************************************************
21  */
22
23 package org.iotivity.service.easysetup.mediator.enums;
24
25 /**
26  * This enum class indicates a WiFi mode like 11A and 11N.
27  */
28 public enum WIFI_MODE
29 {
30     /**
31      * 801.11A
32      */
33     WIFI_11A(0),
34
35     /**
36      * 801.11B
37      */
38     WIFI_11B(1),
39
40     /**
41      * 801.11G
42      */
43     WIFI_11G(2),
44
45     /**
46      * 801.11N
47      */
48     WIFI_11N(3),
49
50     /**
51      * 801.11AC
52      */
53     WIFI_11AC(4);
54
55     private int value;
56
57     private WIFI_MODE(int value)
58     {
59         this.value = value;
60     }
61
62     /**
63      * Get WiFi mode as an integer value
64      *
65      * @return int WiFi mode as an integer value
66      */
67     public int getValue()
68     {
69         return value;
70     }
71
72     /**
73      * Convert integer to WIFI_MODE enum value
74      *
75      * @param i An integer value converting
76      * @return WIFI_MODE enum value corresponding to its integer value
77      */
78     public static WIFI_MODE fromInt(int i)
79     {
80         for (WIFI_MODE b : WIFI_MODE.values())
81         {
82             if (b.getValue() == i)
83                 return b;
84         }
85         return null;
86     }
87 }