1 //******************************************************************
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
33 #define OIC_STRING_MAX_VALUE 64
34 #define MAX_WEBLINKLEN 3
35 #define NUM_WIFIMODE 5
38 * Attributes used to form a proper easysetup conforming JSON message.
40 #define OC_RSRVD_ES_PROVSTATUS "ps"
41 #define OC_RSRVD_ES_LAST_ERRORCODE "lec"
42 #define OC_RSRVD_ES_LINKS "links"
43 #define OC_RSRVD_ES_SUPPORTEDWIFIMODE "swmt"
44 #define OC_RSRVD_ES_SUPPORTEDWIFIFREQ "swf"
45 #define OC_RSRVD_ES_SSID "tnn"
46 #define OC_RSRVD_ES_CRED "cd"
47 #define OC_RSRVD_ES_AUTHTYPE "wat"
48 #define OC_RSRVD_ES_ENCTYPE "wet"
49 #define OC_RSRVD_ES_AUTHCODE "ac"
50 #define OC_RSRVD_ES_AUTHPROVIDER "apn"
51 #define OC_RSRVD_ES_CISERVER "cis"
52 #define OC_RSRVD_ES_SERVERID "sid"
53 #define OC_RSRVD_ES_DEVNAME "dn"
54 #define OC_RSRVD_ES_LANGUAGE "lang"
55 #define OC_RSRVD_ES_COUNTRY "ctry"
56 #define OC_RSRVD_ES_MODELNUMBER "mnmo"
57 #define OC_RSRVD_ES_LOCATION "loc"
58 #define OC_RSRVD_ES_HREF "href"
61 * Easysetup defined resoruce types and uris.
63 #define OC_RSRVD_ES_RES_TYPE_PROV "oic.wk.prov"
64 #define OC_RSRVD_ES_URI_PROV "/ProvisioningResURI"
65 #define OC_RSRVD_ES_RES_TYPE_WIFI "oic.wk.wifi"
66 #define OC_RSRVD_ES_URI_WIFI "/WiFiProvisioningResURI"
67 #define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER "oic.wk.cloudserver"
68 #define OC_RSRVD_ES_URI_CLOUDSERVER "/CloudServerProvisioningResURI"
69 #define OC_RSRVD_ES_RES_TYPE_DEVCONF "oic.wk.devconf"
70 #define OC_RSRVD_ES_URI_DEVCONF "/DevConfProvisioningResURI"
74 * @brief Supported WIFI frequency like 2.4G and 5G
78 WIFI_24G = 0, /**< 2.4G **/
80 WIFI_BOTH, /**< 2.4G and 5G **/
81 WIFI_FREQ_NONE /**< EOF **/
85 * @brief Supported WIFI mode like 802.11g and 802.11n
89 WIFI_11A = 0, /**< 802.11a **/
90 WIFI_11B, /**< 802.11b **/
91 WIFI_11G, /**< 802.11g **/
92 WIFI_11N, /**< 802.11n **/
93 WIFI_11AC, /**< 802.11ac **/
99 * @brief WIFI Authentication tlype of the Enroller
103 NONE_AUTH = 0, /**< NO authentication **/
105 WPA_PSK, /**< WPA-PSK **/
106 WPA2_PSK /**< WPA2-PSK **/
110 * @brief WIFI encryption type of the Enroller
114 NONE_ENC = 0, /**< NO encryption **/
115 WEP_64, /**< WEP-64 **/
116 WEP_128, /**< WEP-128**/
119 TKIP_AES /**< TKIP-AES **/
123 * @brief A result of Easy Setup
128 * Provisioning succeeds.
133 * Enrollee discovery fails in cloud provisioning
135 ES_ENROLLEE_DISCOVERY_FAILURE = 11,
138 * Valid GET or POST request fails for some reason.
139 * This failure may happen when it failed to receive any response from Enrollee by a timeout threshold
141 ES_COMMUNICATION_ERROR,
144 * Security opertion is not supported because Mediator is built as unsecured mode.
146 ES_SEC_OPERATION_IS_NOT_SUPPORTED = 20,
149 * Security resource discovery fails due to loss of discovery packet or absence of the resource in a network
151 ES_SECURE_RESOURCE_DISCOVERY_FAILURE,
154 * Ownership transfer fails because DTLS handshake failure happens
156 ES_OWNERSHIP_TRANSFER_FAILURE,
159 * ACL provisioning fails in cloud provisioning.
160 * It could be that UUID format of cloud server is wrong.
161 * Or any response for the provisioning request is not arrived at Mediator
163 ES_ACL_PROVISIONING_FAILURE,
166 * Cert. provisioning fails in cloud provisioning.
167 * It could be that you put a wrong cred ID of which the corresponding certificate does not exist in SVR DB.
168 * Or any response for the provisioning request is not arrived at Mediator
170 ES_CERT_PROVISIONING_FAILURE,
173 * Provisioning fails for some reason.
179 * @brief Indicate which resource is created in Enrollee
183 ES_WIFI_RESOURCE = 0x01,
184 ES_CLOUD_RESOURCE = 0x02,
185 ES_DEVCONF_RESOURCE = 0x04
189 * @brief Indicate enrollee and provisioning status. Provisioning status is shown in "provisioning
190 * status" property in provisioning resource.
195 * Default state of the device
200 * Status indicating being cnnecting to target network
202 ES_STATE_CONNECTING_TO_ENROLLER,
205 * Status indicating successful conection to target network
207 ES_STATE_CONNECTED_TO_ENROLLER,
210 * Status indicating failure connection to target network
212 ES_STATE_CONNECTED_FAIL_TO_ENROLLER,
215 * Status indicating successful registration to cloud
217 ES_STATE_REGISTERED_TO_CLOUD,
220 * Status indicating failure registeration to cloud
222 ES_STATE_REGISTRRED_FAIL_TO_CLOUD
223 } ESEnrolleeState, ProvStatus;
226 * @brief Indicate last error code to describe a reason of error during easy setup.
233 ES_ERRCODE_NO_ERROR = 0,
236 * Error Code that given WiFi's SSID is not found
238 ES_ERRCODE_SSID_NOT_FOUND,
241 * Error Code that given WiFi's Password is wrong
246 * Error Code that IP address is not allocated
248 ES_ERRCODE_IP_NOT_ALLOCATED,
251 * Error Code that there is no Internet connection
253 ES_ERRCODE_NO_INTERNETCONNECTION,
256 * Error Code that Timeout occured
261 * Error Code that Unknown error occured
270 #endif //ES_COMMON_H_