1 //******************************************************************
3 // Copyright 2016 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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef ES_COMMON_RICH_H_
22 #define ES_COMMON_RICH_H_
40 * Attributes used to form a proper easysetup conforming JSON message
42 #define OC_RSRVD_ES_PROVSTATUS "ps"
43 #define OC_RSRVD_ES_LAST_ERRORCODE "lec"
44 #define OC_RSRVD_ES_LINKS "links"
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 "ctry"
59 * Easysetup defined resoruce types and uris
61 #define OC_RSRVD_ES_RES_TYPE_PROV "ocf.wk.prov"
62 #define OC_RSRVD_ES_URI_PROV "/.well-known/ocf/prov"
63 #define OC_RSRVD_ES_RES_TYPE_WIFI "ocf.wk.wifi"
64 #define OC_RSRVD_ES_URI_WIFI "/.well-known/ocf/prov/wifi"
65 #define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER "ocf.wk.cloudserver"
66 #define OC_RSRVD_ES_URI_CLOUDSERVER "/.well-known/ocf/prov/cloudserver"
67 #define OC_RSRVD_ES_RES_TYPE_DEVCONF "ocf.wk.devconf"
68 #define OC_RSRVD_ES_URI_DEVCONF "/.well-known/ocf/prov/devconf"
81 ES_NETWORKNOTCONNECTED,
82 ES_RESOURCECREATED = 11,
83 ES_RECVREQOFPROVRES = 21,
85 ES_RECVUPDATEOFPROVRES,
86 ES_RECVTRIGGEROFPROVRES,
91 * @brief WIFI Authentication tlype of the Enroller
102 * @brief WIFI encryption type of the Enroller
141 string ssid; /**< ssid of the Enroller**/
142 string pwd; /**< pwd of the Enroller**/
143 WIFI_AUTHTYPE authtype; /**< auth type of the Enroller**/
144 WIFI_ENCTYPE enctype; /**< encryption type of the Enroller**/
163 vector<WIFI_MODE> types;
169 ES_PROVISIONING_ERROR = -1,
170 ES_NEED_PROVISIONING,
171 ES_PROVISIONED_ALREADY,
172 ES_PROVISIONING_SUCCESS
177 ES_CLOUD_PROVISIONING_ERROR = -1,
178 ES_CLOUD_PROVISIONING_SUCCESS,
179 ES_CLOUD_ENROLLEE_FOUND,
180 ES_CLOUD_ENROLLEE_NOT_FOUND
185 * Security Provisioning Status
187 class SecProvisioningStatus
190 SecProvisioningStatus(string deviceUUID, ESResult result) :
191 m_devUUID(deviceUUID), m_result(result)
195 const string getDeviceUUID()
200 ESResult getESResult()
216 EnrolleeConf(DeviceConfig devConfig, WiFiConfig wifiConfig, bool cloudable) :
217 m_devConfig(devConfig), m_wifiConfig(wifiConfig), m_cloudable(cloudable)
221 const DeviceConfig& getDevConf() const
226 const WiFiConfig& getWiFiConf() const
231 bool isCloudable() const
237 DeviceConfig m_devConfig;
238 WiFiConfig m_wifiConfig;
242 class GetConfigurationStatus
245 GetConfigurationStatus(ESResult result, const EnrolleeConf& conf) :
246 m_result(result), m_enrolleeConf(conf)
250 ESResult getESResult()
255 const EnrolleeConf& getEnrolleeConf()
257 return m_enrolleeConf;
262 EnrolleeConf m_enrolleeConf;
265 class DevicePropProvisioningStatus
268 DevicePropProvisioningStatus(ESResult result) :
273 ESResult getESResult()
283 class CloudPropProvisioningStatus
286 CloudPropProvisioningStatus(ESResult result, ESCloudProvState state) :
287 m_result(result), m_esCloudState(state)
291 ESResult getESResult()
296 ESCloudProvState getESCloudState()
298 return m_esCloudState;
303 ESCloudProvState m_esCloudState;
307 * Callback function definition for providing Enrollee security status
309 typedef function< void(shared_ptr< GetConfigurationStatus >) > GetConfigurationStatusCb;
312 * Callback function definition for providing Enrollee security status
314 typedef function< void(shared_ptr< DevicePropProvisioningStatus >) > DevicePropProvStatusCb;
317 * Callback function definition for providing Enrollee security status
319 typedef function< void(shared_ptr< CloudPropProvisioningStatus >) > CloudPropProvStatusCb;
322 * Callback function definition for providing Enrollee security status
324 typedef function< void(shared_ptr<SecProvisioningStatus>) > SecurityProvStatusCb;
327 * Callback definition to be invoked when the security stack expects a pin from application
329 typedef function< void(string&) > SecurityPinCb;
332 * Callback definition to be invoked when the stack expects a db path
334 typedef function< void(string&) > SecProvisioningDbPathCb;
338 #endif //WITH_ARDUINO
340 #endif //ES_COMMON_RICH_H_