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 100
34 #define IPV4_ADDR_SIZE 16
38 * @brief Mac address length for BT port
40 #define NET_MACADDR_SIZE 18
43 * Attributes used to form a proper easysetup conforming JSON message.
45 #define OC_RSRVD_ES_PROVSTATUS "ps"
46 #define OC_RSRVD_ES_LAST_ERRORCODE "lec"
47 #define OC_RSRVD_ES_LINKS "links"
48 #define OC_RSRVD_ES_SUPPORTEDWIFIMODE "swmt"
49 #define OC_RSRVD_ES_SUPPORTEDWIFIFREQ "swf"
50 #define OC_RSRVD_ES_SSID "tnn"
51 #define OC_RSRVD_ES_CRED "cd"
52 #define OC_RSRVD_ES_AUTHTYPE "wat"
53 #define OC_RSRVD_ES_ENCTYPE "wet"
54 #define OC_RSRVD_ES_AUTHCODE "ac"
55 #define OC_RSRVD_ES_AUTHPROVIDER "apn"
56 #define OC_RSRVD_ES_CISERVER "cisurl"
57 #define OC_RSRVD_ES_DEVNAME "dn"
58 #define OC_RSRVD_ES_LANGUAGE "lang"
59 #define OC_RSRVD_ES_COUNTRY "ctry"
62 * Easysetup defined resoruce types and uris.
64 #define OC_RSRVD_ES_RES_TYPE_PROV "ocf.r.prov"
65 #define OC_RSRVD_ES_URI_PROV "/.well-known/ocf/prov"
66 #define OC_RSRVD_ES_RES_TYPE_WIFI "ocf.r.wifi"
67 #define OC_RSRVD_ES_URI_WIFI "/.well-known/ocf/prov/wifi"
68 #define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER "ocf.r.cloudserver"
69 #define OC_RSRVD_ES_URI_CLOUDSERVER "/.well-known/ocf/prov/cloudserver"
70 #define OC_RSRVD_ES_RES_TYPE_DEVCONF "ocf.r.devconf"
71 #define OC_RSRVD_ES_URI_DEVCONF "/.well-known/ocf/prov/devconf"
73 #define NUM_WIFIMODE 10
74 #define MAX_SSIDLEN 33
75 #define MAX_CREDLEN 20
77 #define MAX_DEVICELEN 100
78 #define MAX_ERRMSGLEN 100
79 #define MAX_WEBLINKLEN 100
122 ES_NETWORKNOTCONNECTED,
123 ES_RESOURCECREATED = 11,
124 ES_RECVREQOFPROVRES = 21,
126 ES_RECVUPDATEOFPROVRES,
127 ES_RECVTRIGGEROFPROVRES,
133 ES_WIFI_RESOURCE = 0x01,
134 ES_CLOUD_RESOURCE = 0x02,
135 ES_DEVCONF_RESOURCE = 0x04
140 char ssid[MAX_SSIDLEN]; /**< ssid of the Enroller**/
141 char pwd[MAX_CREDLEN]; /**< pwd of the Enroller**/
142 WIFI_AUTHTYPE authtype; /**< auth type of the Enroller**/
143 WIFI_ENCTYPE enctype; /**< encryption type of the Enroller**/
148 char language[OIC_STRING_MAX_VALUE];
149 char country[OIC_STRING_MAX_VALUE];
154 char authCode[OIC_STRING_MAX_VALUE];
155 char authProvider[OIC_STRING_MAX_VALUE];
156 char ciServer[OIC_STRING_MAX_VALUE];
163 WIFI_MODE mode[NUM_WIFIMODE];
168 char deviceName[MAX_DEVICELEN];
175 * Default state of the device
180 * Status indicating successful cnnection to target network
182 ES_STATE_CONNECTED_TO_ENROLLER,
185 * Status indicating failure connection to target network
187 ES_STATE_CONNECTED_FAIL_TO_ENROLLER,
190 * Status indicating successful registration to cloud
192 ES_STATE_REGISTERED_TO_CLOUD,
195 * Status indicating failure registeration to cloud
197 ES_STATE_REGISTRRED_FAIL_TO_CLOUD
198 } ESEnrolleeState, ProvStatus;
205 ES_ERRCODE_NO_ERROR = 0,
208 * Error Code that given WiFi's SSID is not found
210 ES_ERRCODE_SSID_NOT_FOUND,
213 * Error Code that given WiFi's Password is wrong
218 * Error Code that IP address is not allocated
220 ES_ERRCODE_IP_NOT_ALLOCATED,
223 * Error Code that there is no Internet connection
225 ES_ERRCODE_NO_INTERNETCONNECTION,
228 * Error Code that Timeout occured
233 * Error Code that Unknown error occured
242 #endif //ES_COMMON_H_