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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
36 #define OIC_STRING_MAX_VALUE 100
37 #define IPV4_ADDR_SIZE 16
39 #define NET_WIFI_SSID_SIZE 100
40 #define NET_WIFI_PWD_SIZE 100
43 * @brief Mac address length for BT port
45 #define NET_MACADDR_SIZE 18
48 * Attributes used to form a proper easysetup conforming JSON message.
50 #define OC_RSRVD_ES_PS "ps"
51 #define OC_RSRVD_ES_TNN "tnn"
52 #define OC_RSRVD_ES_CD "cd"
53 #define OC_RSRVD_ES_TR "tr"
54 #define OC_RSRVD_ES_TNT "tnt"
55 #define OC_RSRVD_ES_ANT "ant"
58 * Easysetup defined resoruce types and uris.
60 #define OC_RSRVD_ES_PROV_RES_TYPE "oic.r.prov"
61 #define OC_RSRVD_ES_URI_PROV "/oic/prov"
62 #define OC_RSRVD_ES_URI_NET "/oic/net"
65 * @brief Defines for Provisioning status accepted values
67 #define ES_PS_NEED_PROVISIONING 1
68 #define ES_PS_PROVISIONING_COMPLETED 2
69 #define ES_PS_TRIGGER_INIT_VALUE 0
70 #define ES_PS_TRIGGER_CONNECTION 1
74 * Device Roles defined for each device type used in easy setup
84 * On-boarding connection to create Adhoc network.
98 ES_NETWORKNOTCONNECTED,
99 ES_RESOURCECREATED = 11,
100 ES_RECVREQOFPROVRES = 21,
102 ES_RECVUPDATEOFPROVRES,
103 ES_RECVTRIGGEROFPROVRES,
109 * Default state of the device
114 * Device will move to this state once the on boarding begins
116 ES_ON_BOARDING_STATE,
119 * Device will move to this state after successful on-boarding of the device
124 * Device will move to this state once the on boarding is done
126 ES_PROVISIONING_STATE,
129 * Easy setup process is successful.
131 ES_PROVISIONED_STATE,
134 * This state is arbitrary one, any time device can come into this state
135 * Device will move to this state if the ownership transfer initiated by the Application
137 ES_OWNERSHIP_TRANSFERRING_STATE,
140 * This state is arbitrary one, any time device can come into this state
141 * Device will move to this state if the ownership transfer is completed
143 ES_OWNERSHIP_TRANSFERRED_STATE,
146 * This state is arbitrary one, any time device can come into this state
147 * Device will move to this state once the Application factory reset the device
149 ES_FACTORY_RESET_STATE,
152 * Enrollee moves to this state after connecting to target network
154 ES_ON_BOARDED_TARGET_NETWORK_STATE,
158 * Provisioning Device Status
162 // Address of remote server
164 // Indicates adaptor type on which the response was received
165 OCConnectivityType connType;
166 } EasySetupDeviceInfo;
169 * Provosioning Status
173 DEVICE_PROVISIONED = 0,
174 DEVICE_NOT_PROVISIONED,
177 } EasySetupState, ProvStatus;
180 * Response from queries to remote servers.
185 EasySetupState provStatus;
186 // EasySetup Device Info
187 EasySetupDeviceInfo provDeviceInfo;
188 } EasySetupInfo, ProvisioningInfo;
191 * @brief Network information of the Enroller
196 * @brief BT Mac Information
200 char btMacAddress[NET_MACADDR_SIZE]; /**< BT mac address **/
204 * @brief LE MAC Information
208 char leMacAddress[NET_MACADDR_SIZE]; /**< BLE mac address **/
212 * @brief IP Information
216 char ssid[NET_WIFI_SSID_SIZE]; /**< ssid of the Enroller**/
217 char pwd[NET_WIFI_PWD_SIZE]; /**< pwd of the Enroller**/
222 * @brief Network Information
226 ProvData provData; /**< Enroller Network Info**/
227 OCConnectivityType connType; /**< Connectivity Type**/
231 * Client applications implement this callback to consume responses received from Servers.
233 typedef void (*OCProvisioningStatusCB)(EasySetupInfo *easySetupInfo);
236 * @brief This structure represent configuration information to create wifi onboarding SoftAP or connection.
240 // Note : Below structure is not currently used but added for future purpose.
242 char ssid[NET_WIFI_SSID_SIZE]; /**< ssid of the onboarding Adhoc Wifi network**/
243 char pwd[NET_WIFI_PWD_SIZE]; /**< pwd of the onboarding Adhoc wifi network**/
244 bool isSecured; /**< Secure connection**/
245 }WiFiOnboardingConfig;
248 * @brief This structure represent onboarding connection instance.
251 /*Actual use of ipAddress is for unicast discovery, but also used to identify the Enrollee device as of now,
252 device identification should be based on DeviceID in next release.*/
253 char ipAddress[IPV4_ADDR_SIZE]; /**< IP Address of the Enrollee **/
254 bool isSecured; /**< Secure connection**/
255 }WiFiOnboadingConnection;
257 #endif //ES_COMMON_H_