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 / ProvStatus.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  * It defines various states of the cloud provisioning during easy setup process
25  */
26 public enum ProvStatus {
27
28     /**
29      * Default state of the device
30      */
31     ES_STATE_INIT(0),
32
33     /**
34      * Status indicating being connecting to target network
35      */
36     ES_STATE_CONNECTING_TO_ENROLLER(1),
37
38     /**
39      * Status indicating successful connection to target network
40      */
41     ES_STATE_CONNECTED_TO_ENROLLER(2),
42
43     /**
44      * Status indicating failure connection to target network
45      */
46     ES_STATE_CONNECTED_FAIL_TO_ENROLLER(3),
47
48     /**
49      * Status indicating successful registration to cloud
50      */
51     ES_STATE_REGISTERED_TO_CLOUD(4),
52
53     /**
54      * Status indicating failure registration to cloud
55      */
56     ES_STATE_REGISTRRED_FAIL_TO_CLOUD(5);
57
58     private int value;
59
60     private ProvStatus(int value) {
61         this.value = value;
62     }
63
64     public int getValue() {
65         return value;
66     }
67
68     public static ProvStatus fromInt(int i) {
69         for (ProvStatus b : ProvStatus.values()) {
70             if (b.getValue() == i) { return b; }
71         }
72         return null;
73     }
74 };
75