replace : iotivity -> iotivity-sec
[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 cloud server is not reachable due to wrong URL of cloud server, for example.
60      */
61     ES_ERRCODE_FAILED_TO_ACCESS_CLOUD_SERVER(6),
62
63     /**
64      * Error Code that no response is arrived from cloud server
65      */
66     ES_ERRCODE_NO_RESPONSE_FROM_CLOUD_SERVER(7),
67
68     /**
69      * Error Code that a delivered authcode is not valid.
70      */
71     ES_ERRCODE_INVALID_AUTHCODE(8),
72
73     /**
74      * Error Code that a given access token is not valid due to its expiration, for example.
75      */
76     ES_ERRCODE_INVALID_ACCESSTOKEN(9),
77
78     /**
79      * Error Code that a refresh of expired access token is failed due to some reasons.
80      */
81     ES_ERRCODE_FAILED_TO_REFRESH_ACCESSTOKEN(10),
82
83     /**
84      * Error Code that a target device is not discovered in cloud server
85      */
86     ES_ERRCODE_FAILED_TO_FIND_REGISTERED_DEVICE_IN_CLOUD(11),
87
88     /**
89      * Error Code that a target user does not exist in cloud server.
90      */
91     ES_ERRCODE_FAILED_TO_FIND_REGISTERED_USER_IN_CLOUD(12),
92
93     /**
94      * Error Code that an enrollee can not connect to a target WiFi AP because the AP resides in
95      * an unsupported WiFi frequency.
96      */
97     ES_ERRCODE_UNSUPPORTED_WIFI_FREQUENCY(13),
98
99     /**
100      * Error Code that Unknown error occured
101      */
102     ES_ERRCODE_UNKNOWN(255);
103
104     private int value;
105
106     private ESErrorCode(int value) {
107         this.value = value;
108     }
109
110     public int getValue() {
111         return value;
112     }
113
114     public static ESErrorCode fromInt(int i) {
115         for (ESErrorCode b : ESErrorCode.values()) {
116             if (b.getValue() == i) { return b; }
117         }
118         return null;
119     }
120 };
121