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_PS "ps"
43 #define OC_RSRVD_ES_TNN "tnn"
44 #define OC_RSRVD_ES_CD "cd"
45 #define OC_RSRVD_ES_TR "tr"
46 #define OC_RSRVD_ES_TNT "tnt"
47 #define OC_RSRVD_ES_ANT "ant"
50 * Easysetup defined resoruce types and uris.
52 #define OC_RSRVD_ES_PROV_RES_TYPE "oic.r.prov"
53 #define OC_RSRVD_ES_URI_PROV "/oic/prov"
54 #define OC_RSRVD_ES_URI_NET "/oic/net"
57 * @brief Defines for Provisioning status accepted values
59 #define ES_PS_NEED_PROVISIONING 1
60 #define ES_PS_PROVISIONING_COMPLETED 2
61 #define ES_PS_TRIGGER_INIT_VALUE 0
62 #define ES_PS_TRIGGER_CONNECTION 1
66 * Device Roles defined for each device type used in easy setup
76 * On-boarding connection to create Adhoc network.
90 ES_NETWORKNOTCONNECTED,
91 ES_RESOURCECREATED = 11,
92 ES_RECVREQOFPROVRES = 21,
94 ES_RECVUPDATEOFPROVRES,
95 ES_RECVTRIGGEROFPROVRES,
101 * Default state of the device
106 * Device will move to this state once the on boarding begins
108 ES_ON_BOARDING_STATE,
111 * Device will move to this state after successful on-boarding of the device
116 * Device will move to this state once the on boarding is done
118 ES_PROVISIONING_STATE,
121 * Easy setup process is successful.
123 ES_PROVISIONED_STATE,
126 * This state is arbitrary one, any time device can come into this state
127 * Device will move to this state if the ownership transfer initiated by the Application
129 ES_OWNERSHIP_TRANSFERRING_STATE,
132 * This state is arbitrary one, any time device can come into this state
133 * Device will move to this state if the ownership transfer is completed
135 ES_OWNERSHIP_TRANSFERRED_STATE,
138 * This state is arbitrary one, any time device can come into this state
139 * Device will move to this state once the Application factory reset the device
141 ES_FACTORY_RESET_STATE,
144 * Enrollee moves to this state after connecting to target network
146 ES_ON_BOARDED_TARGET_NETWORK_STATE,
150 * Provisioning Device Status
154 // Address of remote server
156 // Indicates adaptor type on which the response was received
157 OCConnectivityType connType;
158 } EasySetupDeviceInfo;
161 * Provosioning Status
165 DEVICE_PROVISIONED = 0,
166 DEVICE_NOT_PROVISIONED,
169 } EasySetupState, ProvStatus;
172 * Response from queries to remote servers.
177 EasySetupState provStatus;
178 // EasySetup Device Info
179 EasySetupDeviceInfo provDeviceInfo;
180 } EasySetupInfo, ProvisioningInfo;
183 * @brief Network information of the Enroller
188 * @brief BT Mac Information
192 char btMacAddress[NET_MACADDR_SIZE]; /**< BT mac address **/
196 * @brief LE MAC Information
200 char leMacAddress[NET_MACADDR_SIZE]; /**< BLE mac address **/
204 * @brief IP Information
208 char ssid[NET_WIFI_SSID_SIZE]; /**< ssid of the Enroller**/
209 char pwd[NET_WIFI_PWD_SIZE]; /**< pwd of the Enroller**/
214 * @brief Network Information
218 ProvData provData; /**< Enroller Network Info**/
219 OCConnectivityType connType; /**< Connectivity Type**/
223 * Client applications implement this callback to consume responses received from Servers.
225 typedef void (*OCProvisioningStatusCB)(EasySetupInfo *easySetupInfo);
228 * @brief This structure represent configuration information to create wifi onboarding SoftAP or connection.
232 // Note : Below structure is not currently used but added for future purpose.
234 char ssid[NET_WIFI_SSID_SIZE]; /**< ssid of the onboarding Adhoc Wifi network**/
235 char pwd[NET_WIFI_PWD_SIZE]; /**< pwd of the onboarding Adhoc wifi network**/
236 bool isSecured; /**< Secure connection**/
237 }WiFiOnboardingConfig;
240 * @brief This structure represent onboarding connection instance.
243 /*Actual use of ipAddress is for unicast discovery, but also used to identify the Enrollee device as of now,
244 device identification should be based on DeviceID in next release.*/
245 char ipAddress[IPV4_ADDR_SIZE]; /**< IP Address of the Enrollee **/
246 bool isSecured; /**< Secure connection**/
247 }WiFiOnboadingConnection;
249 #endif //ES_COMMON_H_