41fc10cacacaf8e95d4ed595341c00da03326798
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / inc / ESRichCommon.h
1 //******************************************************************
2 //
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
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
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
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.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #ifndef ES_COMMON_RICH_H_
22 #define ES_COMMON_RICH_H_
23
24 #include <iostream>
25 #include <string>
26 #ifndef WITH_ARDUINO
27 #include <memory>
28 #include <vector>
29 #endif
30
31 #include "OCPlatform.h"
32 #include "ocstack.h"
33 #include "octypes.h"
34
35 #include "escommon.h"
36
37 using namespace OC;
38 using namespace std;
39
40 #ifndef WITH_ARDUINO
41 namespace OIC
42 {
43     namespace Service
44     {
45         /**
46          * @brief Properties of provisioning resource. It includes a provisioning status and last
47          *        error code.
48          */
49         class EnrolleeStatus
50         {
51         public:
52
53             /**
54              * Constructor
55              */
56             EnrolleeStatus(const OCRepresentation& rep)
57             {
58                 m_rep = rep;
59             }
60
61             EnrolleeStatus(const EnrolleeStatus& enrolleeStatus) :
62                 m_rep(enrolleeStatus.getRepresentation())
63             {
64             }
65
66             EnrolleeStatus(const EnrolleeStatus&& enrolleeStatus) :
67                 m_rep(std::move(enrolleeStatus.getRepresentation()))
68             {
69             }
70
71             /**
72              * Get a provisioning status property of Enrollee.
73              *
74              * @return a provisioning status property of Enrollee
75              */
76             ProvStatus getProvStatus()
77             {
78                 if(m_rep.hasAttribute(OC_RSRVD_ES_PROVSTATUS))
79                 {
80                     return static_cast<ProvStatus>(
81                                         m_rep.getValue<int>(OC_RSRVD_ES_PROVSTATUS));
82                 }
83                 return ES_STATE_INIT;
84             }
85
86             /**
87              * Get a last error code property of Enrollee.
88              *
89              * @return a last error code property of Enrollee.
90              */
91             ESErrorCode getLastErrCode()
92             {
93                 if(m_rep.hasAttribute(OC_RSRVD_ES_LAST_ERRORCODE))
94                 {
95                     return static_cast<ESErrorCode>(
96                                         m_rep.getValue<int>(OC_RSRVD_ES_LAST_ERRORCODE));
97                 }
98                 return ES_ERRCODE_NO_ERROR;
99             }
100
101             /**
102              * Get OCRepresentation object
103              *
104              * @return OCRepresentation object
105              */
106             const OCRepresentation& getRepresentation() const
107             {
108                 return m_rep;
109             }
110         protected:
111             OCRepresentation m_rep;
112         };
113
114         /**
115          * @brief Data class stored for Cloud server property provisioning
116          */
117         class CloudProp
118         {
119         public:
120
121             /**
122              * Constructor
123              */
124             CloudProp()
125             {
126                 m_cloudID = "";
127                 m_credID = 0;
128             }
129
130             CloudProp(const CloudProp& cloudProp) :
131                                             m_rep(cloudProp.toOCRepresentation()),
132                                             m_cloudID(cloudProp.getCloudID()),
133                                             m_credID(cloudProp.getCredID())
134             {
135             }
136
137             CloudProp(const CloudProp&& cloudProp) :
138                                             m_rep(std::move(cloudProp.toOCRepresentation())),
139                                             m_cloudID(cloudProp.getCloudID()),
140                                             m_credID(cloudProp.getCredID())
141             {
142             }
143
144             /**
145              * Constructor with OCRepresentation object. This is used for JNI communication.
146              */
147             CloudProp(const OCRepresentation &rep)
148             {
149                 m_rep = rep;
150                 m_cloudID = "";
151                 m_credID = 0;
152             }
153
154             /**
155              * Set CloudServer resource properties to be delivered to Enrollee
156              *
157              * @param authCode  Auth code issued by OAuth2.0-compatible account server
158              * @param authProvider Auth provider ID
159              * @param ciServer Cloud interface server URL which an Enrollee is going to registered
160              */
161             void setCloudProp(string authCode, string authProvider, string ciServer)
162             {
163                 m_rep.setValue(OC_RSRVD_ES_AUTHCODE, authCode);
164                 m_rep.setValue(OC_RSRVD_ES_AUTHPROVIDER, authProvider);
165                 m_rep.setValue(OC_RSRVD_ES_CISERVER, ciServer);
166             }
167
168             /**
169              * Set CloudServer's UUID
170              *
171              * @param cloudID Cloud Interface server's UUID
172              */
173             void setCloudID(string cloudID)
174             {
175                 m_cloudID = cloudID;
176             }
177
178             /**
179              * Set CloudServer's credential ID of certificate
180              *
181              * @param credID Cloud Interface server's credential ID of certificate
182              */
183             void setCredID(int credID)
184             {
185                 m_credID = credID;
186             }
187
188             /**
189              * Get an auth code to be delivered.
190              *
191              * @return an auth code to be delivered.
192              */
193             std::string getAuthCode() const
194             {
195                 if(m_rep.hasAttribute(OC_RSRVD_ES_AUTHCODE))
196                 {
197                     return m_rep.getValue<std::string>(OC_RSRVD_ES_AUTHCODE);
198                 }
199                 return std::string("");
200             }
201
202             /**
203              * Get an auth provider which issued an auth code
204              *
205              * @return an auth provider which issued an auth code
206              */
207             std::string getAuthProvider() const
208             {
209                 if(m_rep.hasAttribute(OC_RSRVD_ES_AUTHPROVIDER))
210                 {
211                     return m_rep.getValue<std::string>(OC_RSRVD_ES_AUTHPROVIDER);
212                 }
213                 return std::string("");
214             }
215
216             /**
217              * Get a CI server to be delivered
218              *
219              * @return a CI server to be delivered
220              */
221             std::string getCiServer() const
222             {
223                 if(m_rep.hasAttribute(OC_RSRVD_ES_CISERVER))
224                 {
225                     return m_rep.getValue<std::string>(OC_RSRVD_ES_CISERVER);
226                 }
227                 return std::string("");
228             }
229
230             /**
231              * Get a CI server's Uuid to be delivered
232              *
233              * @return a CI server's Uuid to be delivered
234              */
235             std::string getCloudID() const
236             {
237                 return m_cloudID;
238             }
239
240             /**
241              * Get a CI server's credential ID of certificate
242              *
243              * @return a CI server's credential ID of certificated
244              */
245             int getCredID() const
246             {
247                 return m_credID;
248             }
249
250             /**
251              * Get OCRepresentation object
252              *
253              * @return OCRepresentation object
254              */
255             const OCRepresentation &toOCRepresentation() const
256             {
257                 return m_rep;
258             }
259         protected:
260             OCRepresentation m_rep;
261             std::string m_cloudID;
262             int m_credID;
263         };
264
265         /**
266          * @brief Data class stored for Device property provisioning which includes a WiFi
267          *        and device configuration provisioning
268          */
269         class DeviceProp
270         {
271         public:
272
273             /**
274              * Constructor
275              */
276             DeviceProp()
277             {
278             }
279
280             DeviceProp(const DeviceProp& deviceProp) :
281                 m_rep(deviceProp.toOCRepresentation())
282             {
283             }
284
285             DeviceProp(const DeviceProp&& deviceProp) :
286                 m_rep(std::move(deviceProp.toOCRepresentation()))
287             {
288             }
289
290             /**
291              * Constructor with OCRepresentation object. This is used for JNI communication.
292              */
293             DeviceProp(const OCRepresentation &rep)
294             {
295                 m_rep = rep;
296             }
297
298             /**
299              * Set WiFi resource properties to be delivered to Enrollee
300              *
301              * @param ssid Ssid of the Enroller
302              * @param pwd Pwd of the Enrolle
303              * @param authtype Auth type of the Enroller
304              * @param enctype Encryption type of the Enroller
305              *
306              * @see WIFI_AUTHTYPE
307              * @see WIFI_ENCTYPE
308              */
309             void setWiFiProp(string ssid, string pwd, WIFI_AUTHTYPE authtype, WIFI_ENCTYPE enctype)
310             {
311                 m_rep.setValue(OC_RSRVD_ES_SSID, ssid);
312                 m_rep.setValue(OC_RSRVD_ES_CRED, pwd);
313                 m_rep.setValue(OC_RSRVD_ES_AUTHTYPE, authtype);
314                 m_rep.setValue(OC_RSRVD_ES_ENCTYPE, enctype);
315             }
316
317             /**
318              * Set DevConf resource properties to be delivered to Enrollee
319              *
320              * @param language IETF language tag using ISO 639X
321              * @param country ISO Country Code (ISO 3166-1 Alpha-2)
322              */
323             void setDevConfProp(string language, string country, string location)
324             {
325                 m_rep.setValue(OC_RSRVD_ES_LANGUAGE, language);
326                 m_rep.setValue(OC_RSRVD_ES_COUNTRY, country);
327                 m_rep.setValue(OC_RSRVD_ES_LOCATION, location);
328             }
329
330             /**
331              * Get a SSID of Enroller
332              *
333              * @return a SSID of enroller
334              */
335             std::string getSsid() const
336             {
337                 if(m_rep.hasAttribute(OC_RSRVD_ES_SSID))
338                 {
339                     return m_rep.getValue<std::string>(OC_RSRVD_ES_SSID);
340                 }
341                 return std::string("");
342             }
343
344             /**
345              * Get a password of Enroller
346              *
347              * @return a password of enroller
348              */
349             std::string getPassword() const
350             {
351                 if(m_rep.hasAttribute(OC_RSRVD_ES_CRED))
352                 {
353                     return m_rep.getValue<std::string>(OC_RSRVD_ES_CRED);
354                 }
355                 return std::string("");
356             }
357
358             /**
359              * Get an auth type of Enroller
360              *
361              * @return an auth type of enroller
362              *
363              * @see WIFI_AUTHTYPE
364              */
365             WIFI_AUTHTYPE getAuthType() const
366             {
367                 if(m_rep.hasAttribute(OC_RSRVD_ES_AUTHTYPE))
368                 {
369                     return static_cast<WIFI_AUTHTYPE>(m_rep.getValue<int>(OC_RSRVD_ES_AUTHTYPE));
370                 }
371                 return NONE_AUTH;
372             }
373
374             /**
375              * Get an encryption type of Enroller
376              *
377              * @return an encryption type of enroller
378              *
379              * @see WIFI_ENCTYPE
380              */
381             WIFI_ENCTYPE getEncType() const
382             {
383                 if(m_rep.hasAttribute(OC_RSRVD_ES_ENCTYPE))
384                 {
385                     return static_cast<WIFI_ENCTYPE>(m_rep.getValue<int>(OC_RSRVD_ES_ENCTYPE));
386                 }
387                 return NONE_ENC;
388             }
389
390             /**
391              * Get a language to be set. A language is expressed in IETF language tag
392              * using ISO 639X.
393              *
394              * @return a language to be set
395              */
396             std::string getLanguage() const
397             {
398                 if(m_rep.hasAttribute(OC_RSRVD_ES_LANGUAGE))
399                 {
400                     return m_rep.getValue<std::string>(OC_RSRVD_ES_LANGUAGE);
401                 }
402                 return std::string("");
403             }
404
405             /**
406              * Get a country to be set. A country is expressed in ISO Country Code
407              * (ISO 3166-1 Alpha-2)
408              *
409              * @return a country to be set
410              */
411             std::string getCountry() const
412             {
413                 if(m_rep.hasAttribute(OC_RSRVD_ES_COUNTRY))
414                 {
415                     return m_rep.getValue<std::string>(OC_RSRVD_ES_COUNTRY);
416                 }
417                 return std::string("");
418             }
419
420             /**
421              * Get a location to be set. A location is GPS information
422              *
423              * @return a country to be set
424              */
425             std::string getLocation() const
426             {
427                 if(m_rep.hasAttribute(OC_RSRVD_ES_LOCATION))
428                 {
429                     return m_rep.getValue<std::string>(OC_RSRVD_ES_LOCATION);
430                 }
431                 return std::string("");
432             }
433
434             /**
435              * Get OCRepresentation object
436              *
437              * @return OCRepresentation object
438              */
439             const OCRepresentation &toOCRepresentation() const
440             {
441                 return m_rep;
442             }
443
444         protected:
445             OCRepresentation m_rep;
446         };
447
448         /**
449          * Security Provisioning Status
450          */
451         class SecProvisioningStatus
452         {
453         public:
454             SecProvisioningStatus(string deviceUUID, ESResult result) :
455                 m_devUUID(deviceUUID), m_result(result)
456             {
457             }
458
459             const string getDeviceUUID()
460             {
461                 return m_devUUID;
462             }
463
464             /**
465              * Get a result for about security provisioning is success or not.
466              *
467              * @return ::ES_OK\n
468              *         ::ES_SEC_OPERATION_IS_NOT_SUPPORTED\n
469              *         ::ES_SECURE_RESOURCE_DISCOVERY_FAILURE\n
470              *         ::ES_OWNERSHIP_TRANSFER_FAILURE\n
471              *         ::ES_ERROR\n
472              */
473             ESResult getESResult()
474             {
475                 return m_result;
476             }
477         private:
478             string m_devUUID;
479             ESResult m_result;
480         };
481
482         /**
483          * @breif This provide a set of getter APIs from received response for getConfiguration().
484          *        Received information includes a device name, WiFi supported mode, and frequency.
485          *        Additionally, you can know if Enrollee can be access to cloud server with this
486          *        object.
487          */
488         class EnrolleeConf
489         {
490         public:
491             /**
492              * Constructor
493              * The expected OCRepresentation is one for collection resource and has several child
494              * OCRepresentation object corresponding to WiFi, DevConf, and CloudServer resource's
495              * representation.
496              */
497             EnrolleeConf(const OCRepresentation& rep) :
498                 m_ProvRep(rep)
499             {
500             }
501
502             EnrolleeConf(const EnrolleeConf& enrolleeConf) :
503                 m_ProvRep(enrolleeConf.getProvResRep())
504             {
505             }
506
507             EnrolleeConf(const EnrolleeConf&& enrolleeConf) :
508                 m_ProvRep(std::move(enrolleeConf.getProvResRep()))
509             {
510             }
511
512             /**
513              * Get a device name of Enrollee. It is Device's human-friendly name like device model
514              * name.
515              *
516              * @return a device name of Enrollee
517              */
518             std::string getDeviceName() const
519             {
520                 std::vector<OCRepresentation> children = m_ProvRep.getChildren();
521                 for(auto child = children.begin(); child != children.end(); ++child)
522                 {
523                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
524                     {
525                         OCRepresentation rep;
526                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
527                         {
528                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
529                         }
530                         else
531                         {
532                             return std::string("");
533                         }
534
535                         if(rep.hasAttribute(OC_RSRVD_ES_DEVNAME))
536                         {
537                             return rep.getValue<std::string>(OC_RSRVD_ES_DEVNAME);
538                         }
539                     }
540                 }
541                 return std::string("");
542             }
543
544             /**
545              * Get a model number of Enrollee.
546              *
547              * @return a model number of Enrollee
548              */
549             std::string getModelNumber() const
550             {
551                 std::vector<OCRepresentation> children = m_ProvRep.getChildren();
552                 for(auto child = children.begin(); child != children.end(); ++child)
553                 {
554                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
555                     {
556                         OCRepresentation rep;
557                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
558                         {
559                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
560                         }
561                         else
562                         {
563                             return std::string("");
564                         }
565
566                         if(rep.hasAttribute(OC_RSRVD_ES_MODELNUMBER))
567                         {
568                             return rep.getValue<std::string>(OC_RSRVD_ES_MODELNUMBER);
569                         }
570                     }
571                 }
572                 return std::string("");
573             }
574
575             /**
576              * Get a set of WiFi supported modes of Enrollee
577              *
578              * @return a set of WiFi supported modes of Enrollee
579              *
580              * @see WIFI_MODE
581              */
582             vector<WIFI_MODE> getWiFiModes() const
583             {
584                 vector<WIFI_MODE> modes;
585                 modes.clear();
586
587                 std::vector<OCRepresentation> children = m_ProvRep.getChildren();
588                 for(auto child = children.begin(); child != children.end(); ++child)
589                 {
590                     if(child->getUri().find(OC_RSRVD_ES_URI_WIFI) != std::string::npos)
591                     {
592                         OCRepresentation rep;
593                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
594                         {
595                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
596                         }
597                         else
598                         {
599                             return modes;
600                         }
601
602                         if(rep.hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIMODE))
603                         {
604                             for(auto it : rep.getValue
605                                         <std::vector<int>>(OC_RSRVD_ES_SUPPORTEDWIFIMODE))
606                             {
607                                 modes.push_back(static_cast<WIFI_MODE>(it));
608                             }
609                         }
610                     }
611                 }
612                 return modes;
613             }
614
615             /**
616              * Get a WiFi supported frequency of Enrollee
617              *
618              * @return a WiFi supported frequency of Enrollee
619              *
620              * @see WIFI_FREQ
621              */
622             WIFI_FREQ getWiFiFreq() const
623             {
624                 std::vector<OCRepresentation> children = m_ProvRep.getChildren();
625                 for(auto child = children.begin(); child != children.end(); ++child)
626                 {
627                     if(child->getUri().find(OC_RSRVD_ES_URI_WIFI) != std::string::npos)
628                     {
629                         OCRepresentation rep;
630                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
631                         {
632                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
633                         }
634                         else
635                         {
636                             return WIFI_FREQ_NONE;
637                         }
638
639                         if(rep.hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIFREQ))
640                         {
641                             return static_cast<WIFI_FREQ>(
642                                         rep.getValue<int>(OC_RSRVD_ES_SUPPORTEDWIFIFREQ));
643                         }
644                     }
645                 }
646                 return WIFI_FREQ_NONE;
647             }
648
649             /**
650              * Get an accessibility to cloud server of an Enrollee
651              *
652              * @return an accessibility to cloud server of an Enrollee
653              */
654             bool isCloudAccessible() const
655             {
656                 std::vector<OCRepresentation> children = m_ProvRep.getChildren();
657                 for(auto child = children.begin(); child != children.end(); ++child)
658                 {
659                     for(auto rt : child->getResourceTypes())
660                     {
661                         if(0 == rt.compare(OC_RSRVD_ES_RES_TYPE_CLOUDSERVER))
662                         {
663                             return true;
664                         }
665                     }
666                 }
667                 return false;
668             }
669
670             /**
671              * Get OCRepresentation object
672              *
673              * @return OCRepresentation object
674              */
675             const OCRepresentation& getProvResRep() const
676             {
677                 return m_ProvRep;
678             }
679
680         protected:
681             OCRepresentation m_ProvRep;
682         };
683
684         /**
685          * Status object for getStatus API. This object is given to application
686          * when a response for GET request to provisioning resource at Enrollee is arrived.
687          * It returns a result of the API and requested data delivered in the response which includes
688          * a provisioning status and last error code stored in Enrollee.
689          *
690          * @see EnrolleeStatus
691          */
692         class GetEnrolleeStatus
693         {
694         public:
695             /**
696              * Constructor
697              */
698             GetEnrolleeStatus(ESResult result, const EnrolleeStatus& status) :
699                 m_result(result), m_enrolleeStatus(status)
700             {
701             }
702
703             /**
704              * Get a result of getting provisioning status and last error code of Enrollee
705              *
706              * @return ::ES_OK\n
707              *         ::ES_COMMUNICATION_ERROR\n
708              *         ::ES_ERROR\n
709              * @see ESResult
710              */
711             ESResult getESResult()
712             {
713                 return m_result;
714             }
715
716             /**
717              * Get Enrollee's status and last error code properties
718              *
719              * @return Enrollee's status and last error code properties
720              *
721              * @see EnrolleeStatus
722              */
723             const EnrolleeStatus& getEnrolleeStatus()
724             {
725                 return m_enrolleeStatus;
726             }
727
728         private:
729             ESResult m_result;
730             EnrolleeStatus m_enrolleeStatus;
731         };
732
733         /**
734          * Status object for getConfiguration API. This object is given to application
735          * when a response for GET request to provisioning resource at Enrollee is arrived.
736          * It returns a result of the API and requested data delivered in the response which includes
737          * WiFi configuration and device configuration stored in Enrollee.
738          *
739          * @see EnrolleeConf
740          */
741         class GetConfigurationStatus
742         {
743         public:
744             /**
745              * Constructor
746              */
747             GetConfigurationStatus(ESResult result, const EnrolleeConf& conf) :
748                     m_result(result), m_enrolleeConf(conf)
749             {
750             }
751
752             /**
753              * Get a result of getting preconfiguration of Enrollee
754              *
755              * @return ::ES_OK\n
756              *         ::ES_COMMUNICATION_ERROR\n
757              *         ::ES_ERROR\n
758              *
759              * @see ESResult
760              */
761             ESResult getESResult()
762             {
763                 return m_result;
764             }
765
766             /**
767              * Get Enrollee's pre-configuration properties
768              *
769              * @return Enrollee's pre-configuration properties
770              *
771              * @see EnrolleeConf
772              */
773             EnrolleeConf& getEnrolleeConf()
774             {
775                 return m_enrolleeConf;
776             }
777
778         private:
779             ESResult m_result;
780             EnrolleeConf m_enrolleeConf;
781         };
782
783         /**
784          * Status object for provisionDeviceProperties API. This object is given to application
785          * when a response for GET request to provisioning resource at Enrollee is arrived.
786          * It returns a result of the request.
787          */
788         class DevicePropProvisioningStatus
789         {
790         public:
791             /**
792              * Constructor
793              */
794             DevicePropProvisioningStatus(ESResult result) :
795                     m_result(result)
796             {
797             }
798
799             /**
800              * Get a result of Device property provisioning
801              *
802              * @return ::ES_OK\n
803              *         ::ES_COMMUNICATION_ERROR\n
804              *         ::ES_ERROR\n
805              *
806              * @see ESResult
807              */
808             ESResult getESResult()
809             {
810                 return m_result;
811             }
812
813         private:
814             ESResult m_result;
815         };
816
817         /**
818          * Status object for provisionCloudProperties API. This object is given to application
819          * when a response for GET request to provisioning resource at Enrollee is arrived.
820          * It returns a result of the request and status of this provisioning. The status provides
821          * an information if the enrollee is found in a given network and the provisioning is
822          * successfully done.
823          */
824         class CloudPropProvisioningStatus
825         {
826         public:
827             /**
828              * Constructor
829              */
830             CloudPropProvisioningStatus(ESResult result) :
831                     m_result(result)
832             {
833             }
834
835             /**
836              * Get a result of Cloud property provisioning
837              *
838              * @return ::ES_OK\n
839              *         ::ES_ENROLLEE_DISCOVERY_FAILURE\n
840              *         ::ES_SECURE_RESOURCE_DISCOVERY_FAILURE\n
841              *         ::ES_ACL_PROVISIONING_FAILURE\n
842              *         ::ES_CERT_PROVISIONING_FAILURE\n
843              *         ::ES_COMMUNICATION_ERROR\n
844              *         ::ES_ERROR\n
845              *
846              * @see ESResult
847              */
848             ESResult getESResult()
849             {
850                 return m_result;
851             }
852
853         private:
854             ESResult m_result;
855         };
856
857         /**
858          * Callback function definition for providing Enrollee status
859          */
860         typedef function< void(shared_ptr< GetEnrolleeStatus >) > GetStatusCb;
861
862         /**
863          * Callback function definition for providing Enrollee configuration status
864          */
865         typedef function< void(shared_ptr< GetConfigurationStatus >) > GetConfigurationStatusCb;
866
867         /**
868          * Callback function definition for providing Enrollee device property provisioning status
869          */
870         typedef function< void(shared_ptr< DevicePropProvisioningStatus >) > DevicePropProvStatusCb;
871
872         /**
873          * Callback function definition for providing Enrollee cloud property provisioning status
874          */
875         typedef function< void(shared_ptr< CloudPropProvisioningStatus >) > CloudPropProvStatusCb;
876
877         /**
878          * Callback function definition for providing Enrollee security provisioning status
879          */
880         typedef function< void(shared_ptr<SecProvisioningStatus>) > SecurityProvStatusCb;
881
882         /**
883          * Callback definition to be invoked when the security stack expects a pin from application
884          */
885         typedef function< void(string&) > SecurityPinCb;
886
887         /**
888          * Callback definition to be invoked when the stack expects a db path
889          */
890         typedef function< void(string&) > SecProvisioningDbPathCb;
891
892     }
893 }
894 #endif //WITH_ARDUINO
895
896 #endif //ES_COMMON_RICH_H_