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 / ESErrorCode.java
1 /**
2  * ***************************************************************
3  *
4  * Copyright 2016 Samsung Electronics All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * ****************************************************************
19  */
20
21 package org.iotivity.service.easysetup.mediator.enums;
22
23 /**
24  * @brief Indicate last error code to describe a reason of error during easy setup.
25  */
26 public enum ESErrorCode {
27
28     /**
29      * Init Error Code
30      */
31     ES_ERRCODE_NO_ERROR(0),
32
33     /**
34      * Error Code that given WiFi's SSID is not found
35      */
36     ES_ERRCODE_SSID_NOT_FOUND(1),
37
38     /**
39      * Error Code that given WiFi's Password is wrong
40      */
41     ES_ERRCODE_PW_WRONG(2),
42
43     /**
44      * Error Code that IP address is not allocated
45      */
46     ES_ERRCODE_IP_NOT_ALLOCATED(3),
47
48     /**
49      * Error Code that there is no Internet connection
50      */
51     ES_ERRCODE_NO_INTERNETCONNECTION(4),
52
53     /**
54      * Error Code that Timeout occured
55      */
56     ES_ERRCODE_TIMEOUT(5),
57
58     /**
59      * Error Code that Unknown error occured
60      */
61     ES_ERRCODE_UNKNOWN(6);
62
63     private int value;
64
65     private ESErrorCode(int value) {
66         this.value = value;
67     }
68
69     public int getValue() {
70         return value;
71     }
72
73     public static ESErrorCode fromInt(int i) {
74         for (ESErrorCode b : ESErrorCode.values()) {
75             if (b.getValue() == i) { return b; }
76         }
77         return null;
78     }
79 };
80