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 "cis"
54 #define OC_RSRVD_ES_SERVERID "sid"
55 #define OC_RSRVD_ES_DEVNAME "dn"
56 #define OC_RSRVD_ES_LANGUAGE "lang"
57 #define OC_RSRVD_ES_COUNTRY "ctry"
60 * Easysetup defined resoruce types and uris
62 #define OC_RSRVD_ES_RES_TYPE_PROV "ocf.wk.prov"
63 #define OC_RSRVD_ES_URI_PROV "/.well-known/ocf/prov"
64 #define OC_RSRVD_ES_RES_TYPE_WIFI "ocf.wk.wifi"
65 #define OC_RSRVD_ES_URI_WIFI "/.well-known/ocf/prov/wifi"
66 #define OC_RSRVD_ES_RES_TYPE_CLOUDSERVER "ocf.wk.cloudserver"
67 #define OC_RSRVD_ES_URI_CLOUDSERVER "/.well-known/ocf/prov/cloudserver"
68 #define OC_RSRVD_ES_RES_TYPE_DEVCONF "ocf.wk.devconf"
69 #define OC_RSRVD_ES_URI_DEVCONF "/.well-known/ocf/prov/devconf"
82 ES_NETWORKNOTCONNECTED,
83 ES_RESOURCECREATED = 11,
84 ES_RECVREQOFPROVRES = 21,
86 ES_RECVUPDATEOFPROVRES,
87 ES_RECVTRIGGEROFPROVRES,
92 * @brief WIFI Authentication tlype of the Enroller
103 * @brief WIFI encryption type of the Enroller
142 string ssid; /**< ssid of the Enroller**/
143 string pwd; /**< pwd of the Enroller**/
144 WIFI_AUTHTYPE authtype; /**< auth type of the Enroller**/
145 WIFI_ENCTYPE enctype; /**< encryption type of the Enroller**/
164 vector<WIFI_MODE> modes;
170 ES_PROVISIONING_ERROR = -1,
171 ES_NEED_PROVISIONING,
172 ES_PROVISIONED_ALREADY,
173 ES_PROVISIONING_SUCCESS
178 ES_CLOUD_PROVISIONING_ERROR = -1,
179 ES_CLOUD_PROVISIONING_SUCCESS,
180 ES_CLOUD_ENROLLEE_FOUND,
181 ES_CLOUD_ENROLLEE_NOT_FOUND
186 * Security Provisioning Status
188 class SecProvisioningStatus
191 SecProvisioningStatus(string deviceUUID, ESResult result) :
192 m_devUUID(deviceUUID), m_result(result)
196 const string getDeviceUUID()
201 ESResult getESResult()
217 EnrolleeConf(DeviceConfig devConfig, WiFiConfig wifiConfig, bool cloudable) :
218 m_devConfig(devConfig), m_wifiConfig(wifiConfig), m_cloudable(cloudable)
222 const DeviceConfig& getDevConf() const
227 const WiFiConfig& getWiFiConf() const
232 bool isCloudable() const
238 DeviceConfig m_devConfig;
239 WiFiConfig m_wifiConfig;
243 class GetConfigurationStatus
246 GetConfigurationStatus(ESResult result, const EnrolleeConf& conf) :
247 m_result(result), m_enrolleeConf(conf)
251 ESResult getESResult()
256 const EnrolleeConf& getEnrolleeConf()
258 return m_enrolleeConf;
263 EnrolleeConf m_enrolleeConf;
266 class DevicePropProvisioningStatus
269 DevicePropProvisioningStatus(ESResult result) :
274 ESResult getESResult()
284 class CloudPropProvisioningStatus
287 CloudPropProvisioningStatus(ESResult result, ESCloudProvState state) :
288 m_result(result), m_esCloudState(state)
292 ESResult getESResult()
297 ESCloudProvState getESCloudState()
299 return m_esCloudState;
304 ESCloudProvState m_esCloudState;
308 * Callback function definition for providing Enrollee security status
310 typedef function< void(shared_ptr< GetConfigurationStatus >) > GetConfigurationStatusCb;
313 * Callback function definition for providing Enrollee security status
315 typedef function< void(shared_ptr< DevicePropProvisioningStatus >) > DevicePropProvStatusCb;
318 * Callback function definition for providing Enrollee security status
320 typedef function< void(shared_ptr< CloudPropProvisioningStatus >) > CloudPropProvStatusCb;
323 * Callback function definition for providing Enrollee security status
325 typedef function< void(shared_ptr<SecProvisioningStatus>) > SecurityProvStatusCb;
328 * Callback definition to be invoked when the security stack expects a pin from application
330 typedef function< void(string&) > SecurityPinCb;
333 * Callback definition to be invoked when the stack expects a db path
335 typedef function< void(string&) > SecProvisioningDbPathCb;
339 #endif //WITH_ARDUINO
341 #endif //ES_COMMON_RICH_H_