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 OC_RSRVD_ES_RES_TYPE_COL "oic.wk.col"
34 #define OC_RSRVD_ES_INTERFACE "if"
35 #define OC_RSRVD_ES_RES_TYPE "rt"
39 #define OIC_STRING_MAX_VALUE 64
40 #define MAX_WEBLINKLEN 3
41 #define NUM_WIFIMODE 5
44 * Attributes used to form a proper easysetup conforming JSON message.
46 #define OC_RSRVD_ES_PROVSTATUS "ps"
47 #define OC_RSRVD_ES_LAST_ERRORCODE "lec"
48 #define OC_RSRVD_ES_LINKS "links"
49 #define OC_RSRVD_ES_SUPPORTEDWIFIMODE "swmt"
50 #define OC_RSRVD_ES_SUPPORTEDWIFIFREQ "swf"
51 #define OC_RSRVD_ES_SSID "tnn"
52 #define OC_RSRVD_ES_CRED "cd"
53 #define OC_RSRVD_ES_AUTHTYPE "wat"
54 #define OC_RSRVD_ES_ENCTYPE "wet"
55 #define OC_RSRVD_ES_AUTHCODE "ac"
56 #define OC_RSRVD_ES_AUTHPROVIDER "apn"
57 #define OC_RSRVD_ES_CISERVER "cis"
58 #define OC_RSRVD_ES_SERVERID "sid"
59 #define OC_RSRVD_ES_DEVNAME "dn"
60 #define OC_RSRVD_ES_LANGUAGE "lang"
61 #define OC_RSRVD_ES_COUNTRY "ctry"
62 #define OC_RSRVD_ES_MODELNUMBER "mnmo"
63 #define OC_RSRVD_ES_LOCATION "loc"
64 #define OC_RSRVD_ES_HREF "href"
67 * Easysetup defined resoruce types and uris.
69 #define OC_RSRVD_ES_RES_TYPE_PROV "oic.wk.prov"
70 #define OC_RSRVD_ES_URI_PROV "/ProvisioningResURI"
71 #define OC_RSRVD_ES_RES_TYPE_WIFI "oic.wk.wifi"
72 #define OC_RSRVD_ES_URI_WIFI "/WiFiProvisioningResURI"
73 #define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER "oic.wk.cloudserver"
74 #define OC_RSRVD_ES_URI_CLOUDSERVER "/CloudServerProvisioningResURI"
75 #define OC_RSRVD_ES_RES_TYPE_DEVCONF "oic.wk.devconf"
76 #define OC_RSRVD_ES_URI_DEVCONF "/DevConfProvisioningResURI"
80 * @brief Supported WIFI frequency like 2.4G and 5G
84 WIFI_24G = 0, /**< 2.4G **/
86 WIFI_BOTH, /**< 2.4G and 5G **/
87 WIFI_FREQ_NONE /**< EOF **/
91 * @brief Supported WIFI mode like 802.11g and 802.11n
95 WIFI_11A = 0, /**< 802.11a **/
96 WIFI_11B, /**< 802.11b **/
97 WIFI_11G, /**< 802.11g **/
98 WIFI_11N, /**< 802.11n **/
99 WIFI_11AC, /**< 802.11ac **/
105 * @brief WIFI Authentication tlype of the Enroller
109 NONE_AUTH = 0, /**< NO authentication **/
111 WPA_PSK, /**< WPA-PSK **/
112 WPA2_PSK /**< WPA2-PSK **/
116 * @brief WIFI encryption type of the Enroller
120 NONE_ENC = 0, /**< NO encryption **/
121 WEP_64, /**< WEP-64 **/
122 WEP_128, /**< WEP-128**/
125 TKIP_AES /**< TKIP-AES **/
129 * @brief A result of Easy Setup
134 * Provisioning succeeds.
139 * Enrollee discovery fails in cloud provisioning
141 ES_ENROLLEE_DISCOVERY_FAILURE = 11,
144 * Valid GET or POST request fails for some reason.
145 * This failure may happen when it failed to receive any response from Enrollee by a timeout threshold
147 ES_COMMUNICATION_ERROR,
150 * Security opertion is not supported because Mediator is built as unsecured mode.
152 ES_SEC_OPERATION_IS_NOT_SUPPORTED = 20,
155 * Security resource discovery fails due to loss of discovery packet or absence of the resource in a network
157 ES_SECURE_RESOURCE_DISCOVERY_FAILURE,
160 * Ownership transfer fails because DTLS handshake failure happens
162 ES_OWNERSHIP_TRANSFER_FAILURE,
165 * ACL provisioning fails in cloud provisioning.
166 * It could be that UUID format of cloud server is wrong.
167 * Or any response for the provisioning request is not arrived at Mediator
169 ES_ACL_PROVISIONING_FAILURE,
172 * Cert. provisioning fails in cloud provisioning.
173 * It could be that you put a wrong cred ID of which the corresponding certificate does not exist in SVR DB.
174 * Or any response for the provisioning request is not arrived at Mediator
176 ES_CERT_PROVISIONING_FAILURE,
179 * Provisioning fails for some reason.
185 * @brief Indicate which resource is created in Enrollee
189 ES_WIFI_RESOURCE = 0x01,
190 ES_CLOUD_RESOURCE = 0x02,
191 ES_DEVCONF_RESOURCE = 0x04
195 * @brief Indicate enrollee and provisioning status. Provisioning status is shown in "provisioning
196 * status" property in provisioning resource.
201 * Default state of the device
206 * Status indicating being connecting to target network
208 ES_STATE_CONNECTING_TO_ENROLLER,
211 * Status indicating successful conection to target network
213 ES_STATE_CONNECTED_TO_ENROLLER,
216 * Status indicating connection failure to target network
218 ES_STATE_FAILED_TO_CONNECT_TO_ENROLLER,
221 * Status indicating being registering to cloud
223 ES_STATE_REGISTERING_TO_CLOUD,
226 * Status indicating successful registration to cloud
228 ES_STATE_REGISTERED_TO_CLOUD,
231 * Status indicating registeration failure to cloud
233 ES_STATE_FAILED_TO_REGISTER_TO_CLOUD,
236 * Status indicating being publishing resources to cloud
238 ES_STATE_PUBLISHING_RESOURCES_TO_CLOUD,
241 * Status indicating successful resource publish to cloud
243 ES_STATE_PUBLISHED_RESOURCES_TO_CLOUD,
246 * Status indicating resource publish failure to cloud
248 ES_STATE_FAILED_TO_PUBLISH_RESOURCES_TO_CLOUD,
251 * End of Easy setup status
254 } ESEnrolleeState, ProvStatus;
257 * @brief Indicate last error code to describe a reason of error during easy setup.
264 ES_ERRCODE_NO_ERROR = 0,
267 * Error Code that given WiFi's SSID is not found
269 ES_ERRCODE_SSID_NOT_FOUND,
272 * Error Code that given WiFi's Password is wrong
277 * Error Code that IP address is not allocated
279 ES_ERRCODE_IP_NOT_ALLOCATED,
282 * Error Code that there is no Internet connection
284 ES_ERRCODE_NO_INTERNETCONNECTION,
287 * Error Code that Timeout occured
292 * Error Code that cloud server is not reachable due to wrong URL of cloud server, for example.
294 ES_ERRCODE_FAILED_TO_ACCESS_CLOUD_SERVER,
297 * Error Code that no response is arrived from cloud server
299 ES_ERRCODE_NO_RESPONSE_FROM_CLOUD_SERVER,
302 * Error Code that a delivered authcode is not valid.
304 ES_ERRCODE_INVALID_AUTHCODE,
307 * Error Code that a given access token is not valid due to its expiration, for example.
309 ES_ERRCODE_INVALID_ACCESSTOKEN,
312 * Error Code that a refresh of expired access token is failed due to some reasons.
314 ES_ERRCODE_FAILED_TO_REFRESH_ACCESSTOKEN,
317 * Error Code that a target device is not discovered in cloud server
319 ES_ERRCODE_FAILED_TO_FIND_REGISTERED_DEVICE_IN_CLOUD,
322 * Error Code that a target user does not exist in cloud server.
324 ES_ERRCODE_FAILED_TO_FIND_REGISTERED_USER_IN_CLOUD,
327 * Error Code that Unknown error occured
329 ES_ERRCODE_UNKNOWN = 255
336 #endif //ES_COMMON_H_