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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
28 #define OIC_STRING_MAX_VALUE 100
29 #define IPV4_ADDR_SIZE 16
31 #define NET_WIFI_SSID_SIZE 100
32 #define NET_WIFI_PWD_SIZE 100
35 * @brief Mac address length for BT port
37 #define NET_MACADDR_SIZE 18
40 * Attributes used to form a proper easysetup conforming JSON message.
42 #define OC_RSRVD_ES_PROVSTATUS "ps"
43 #define OC_RSRVD_ES_ERRORCODE "ec"
44 #define OC_RSRVD_ES_TRIGGER "tr"
45 #define OC_RSRVD_ES_SUPPORTEDWIFIMODE "swmt"
46 #define OC_RSRVD_ES_SUPPORTEDWIFIFREQ "swf"
47 #define OC_RSRVD_ES_SSID "tnn"
48 #define OC_RSRVD_ES_CRED "cd"
49 #define OC_RSRVD_ES_AUTHTYPE "wat"
50 #define OC_RSRVD_ES_ENCTYPE "wet"
51 #define OC_RSRVD_ES_AUTHCODE "ac"
52 #define OC_RSRVD_ES_AUTHPROVIDER "apn"
53 #define OC_RSRVD_ES_CISERVER "cisurl"
54 #define OC_RSRVD_ES_DEVNAME "dn"
55 #define OC_RSRVD_ES_LANGUAGE "lang"
56 #define OC_RSRVD_ES_COUNTRY "cont"
59 * Easysetup defined resoruce types and uris.
61 #define OC_RSRVD_ES_RES_TYPE_PROV "ocf.r.prov"
62 #define OC_RSRVD_ES_URI_PROV "/.well-known/ocf/prov"
63 #define OC_RSRVD_ES_RES_TYPE_WIFI "ocf.r.wifi"
64 #define OC_RSRVD_ES_URI_WIFI "/.well-known/ocf/prov/wifi"
65 #define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER "ocf.r.cloudserver"
66 #define OC_RSRVD_ES_URI_CLOUDSERVER "/.well-known/ocf/prov/cloudserver"
67 #define OC_RSRVD_ES_RES_TYPE_DEVCONF "ocf.r.devconf"
68 #define OC_RSRVD_ES_URI_DEVCONF "/.well-known/ocf/prov/devconf"
70 #define OC_RSRVD_ES_URI_NET "/oic/net"
72 #define NUM_WIFIMODE 10
116 * Device Roles defined for each device type used in easy setup
126 * On-boarding connection to create Adhoc network.
140 ES_NETWORKNOTCONNECTED,
141 ES_RESOURCECREATED = 11,
142 ES_RECVREQOFPROVRES = 21,
144 ES_RECVUPDATEOFPROVRES,
145 ES_RECVTRIGGEROFPROVRES,
151 * Default state of the device
156 * Device will move to this state once the on boarding begins
158 ES_ON_BOARDING_STATE,
161 * Device will move to this state after successful on-boarding of the device
166 * Device will move to this state once the on boarding is done
168 ES_PROVISIONING_STATE,
171 * Easy setup process is successful.
173 ES_PROVISIONED_STATE,
176 * This state is arbitrary one, any time device can come into this state
177 * Device will move to this state if the ownership transfer initiated by the Application
179 ES_OWNERSHIP_TRANSFERRING_STATE,
182 * This state is arbitrary one, any time device can come into this state
183 * Device will move to this state if the ownership transfer is completed
185 ES_OWNERSHIP_TRANSFERRED_STATE,
188 * This state is arbitrary one, any time device can come into this state
189 * Device will move to this state once the Application factory reset the device
191 ES_FACTORY_RESET_STATE,
194 * Enrollee moves to this state after connecting to target network
196 ES_ON_BOARDED_TARGET_NETWORK_STATE,
200 * Provisioning Device Status
204 // Address of remote server
206 // Indicates adaptor type on which the response was received
207 OCConnectivityType connType;
208 } EasySetupDeviceInfo;
211 * Provosioning Status
215 DEVICE_PROVISIONED = 0,
216 DEVICE_NOT_PROVISIONED,
219 } EasySetupState, ProvStatus;
222 * Response from queries to remote servers.
227 EasySetupState provStatus;
228 // EasySetup Device Info
229 EasySetupDeviceInfo provDeviceInfo;
230 } EasySetupInfo, ProvisioningInfo;
233 * @brief Network information of the Enroller
238 * @brief BT Mac Information
242 char btMacAddress[NET_MACADDR_SIZE]; /**< BT mac address **/
246 * @brief LE MAC Information
250 char leMacAddress[NET_MACADDR_SIZE]; /**< BLE mac address **/
254 * @brief IP Information
258 char ssid[NET_WIFI_SSID_SIZE]; /**< ssid of the Enroller**/
259 char pwd[NET_WIFI_PWD_SIZE]; /**< pwd of the Enroller**/
264 * @brief Network Information
268 ProvData provData; /**< Enroller Network Info**/
269 OCConnectivityType connType; /**< Connectivity Type**/
273 * Client applications implement this callback to consume responses received from Servers.
275 typedef void (*OCProvisioningStatusCB)(EasySetupInfo *easySetupInfo);
278 * @brief This structure represent configuration information to create wifi onboarding SoftAP or connection.
282 // Note : Below structure is not currently used but added for future purpose.
284 char ssid[NET_WIFI_SSID_SIZE]; /**< ssid of the onboarding Adhoc Wifi network**/
285 char pwd[NET_WIFI_PWD_SIZE]; /**< pwd of the onboarding Adhoc wifi network**/
286 bool isSecured; /**< Secure connection**/
287 }WiFiOnboardingConfig;
290 * @brief This structure represent onboarding connection instance.
293 /*Actual use of ipAddress is for unicast discovery, but also used to identify the Enrollee device as of now,
294 device identification should be based on DeviceID in next release.*/
295 char ipAddress[IPV4_ADDR_SIZE]; /**< IP Address of the Enrollee **/
296 bool isSecured; /**< Secure connection**/
297 }WiFiOnboadingConnection;
299 #endif //ES_COMMON_H_