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"
60 * Easysetup defined resoruce types and uris.
62 #define OC_RSRVD_ES_RES_TYPE_PROV "oic.wk.prov"
63 #define OC_RSRVD_ES_URI_PROV "/ProvisioningResURI"
64 #define OC_RSRVD_ES_RES_TYPE_WIFI "oic.wk.wifi"
65 #define OC_RSRVD_ES_URI_WIFI "/WiFiProvisioningResURI"
66 #define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER "oic.wk.cloudserver"
67 #define OC_RSRVD_ES_URI_CLOUDSERVER "/CloudServerProvisioningResURI"
68 #define OC_RSRVD_ES_RES_TYPE_DEVCONF "oic.wk.devconf"
69 #define OC_RSRVD_ES_URI_DEVCONF "/DevConfProvisioningResURI"
73 * @brief Supported WIFI frequency like 2.4G and 5G
77 WIFI_24G = 0, /**< 2.4G **/
79 WIFI_BOTH, /**< 2.4G and 5G **/
80 WIFI_FREQ_NONE /**< EOF **/
84 * @brief Supported WIFI mode like 802.11g and 802.11n
88 WIFI_11A = 0, /**< 802.11a **/
89 WIFI_11B, /**< 802.11b **/
90 WIFI_11G, /**< 802.11g **/
91 WIFI_11N, /**< 802.11n **/
92 WIFI_11AC, /**< 802.11ac **/
98 * @brief WIFI Authentication tlype of the Enroller
102 NONE_AUTH = 0, /**< NO authentication **/
104 WPA_PSK, /**< WPA-PSK **/
105 WPA2_PSK /**< WPA2-PSK **/
109 * @brief WIFI encryption type of the Enroller
113 NONE_ENC = 0, /**< NO encryption **/
114 WEP_64, /**< WEP-64 **/
115 WEP_128, /**< WEP-128**/
118 TKIP_AES /**< TKIP-AES **/
122 * @brief A result of Easy Setup
127 * Provisioning succeeds.
132 * Successfully found Enrollee in a given network. This will be given in Cloud provisioning step.
134 ES_FOUND_ENROLLEE = 1,
137 * Not found Enrollee in a give network. This will be given in Cloud provisioning step.
139 ES_NOT_FOUND_ENROLLEE = 11,
142 * Security opertion is not supported because it is built as unsecured mode.
144 ES_SEC_OPERATION_IS_NOT_SUPPORTED = 20,
147 * A previous request is denied due to its unauthority. It means, Mediator is not unauthroized
148 * to Enrollee for some reaons.
150 ES_UNAUTHORIZED_REQ = 21,
153 * Security provisioning fails. The reasons would be: a packet loss for unowned/owned device
154 * discovery request or ownership transfer request, or a denial to ownership transfer by Enrollee
157 ES_SEC_PROVISION_FAILS = 22,
160 * Provisioning fails for some reason.
166 * @brief Indicate which resource is created in Enrollee
170 ES_WIFI_RESOURCE = 0x01,
171 ES_CLOUD_RESOURCE = 0x02,
172 ES_DEVCONF_RESOURCE = 0x04
176 * @brief Indicate enrollee and provisioning status. Provisioning status is shown in "provisioning
177 * status" property in provisioning resource.
182 * Default state of the device
187 * Status indicating being cnnecting to target network
189 ES_STATE_CONNECTING_TO_ENROLLER,
192 * Status indicating successful conection to target network
194 ES_STATE_CONNECTED_TO_ENROLLER,
197 * Status indicating failure connection to target network
199 ES_STATE_CONNECTED_FAIL_TO_ENROLLER,
202 * Status indicating successful registration to cloud
204 ES_STATE_REGISTERED_TO_CLOUD,
207 * Status indicating failure registeration to cloud
209 ES_STATE_REGISTRRED_FAIL_TO_CLOUD
210 } ESEnrolleeState, ProvStatus;
213 * @brief Indicate last error code to describe a reason of error during easy setup.
220 ES_ERRCODE_NO_ERROR = 0,
223 * Error Code that given WiFi's SSID is not found
225 ES_ERRCODE_SSID_NOT_FOUND,
228 * Error Code that given WiFi's Password is wrong
233 * Error Code that IP address is not allocated
235 ES_ERRCODE_IP_NOT_ALLOCATED,
238 * Error Code that there is no Internet connection
240 ES_ERRCODE_NO_INTERNETCONNECTION,
243 * Error Code that Timeout occured
248 * Error Code that Unknown error occured
257 #endif //ES_COMMON_H_