Added Samsung Specific Property(sso list) for easy setup
[platform/upstream/iotivity.git] / service / easy-setup / mediator / richsdk / inc / ESSCCommon.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 ESSC_COMMON_RICH_H_
22 #define ESSC_COMMON_RICH_H_
23
24 #include "ESRichCommon.h"
25
26 using namespace OC;
27 using namespace std;
28
29 #define SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE  "x.com.samsung.ncs"
30 #define SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL    "x.com.samsung.chn"
31 #define SC_RSRVD_ES_VENDOR_DEVICE_TYPE          "x.com.samsung.dt"
32 #define SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE       "x.com.samsung.sdt"
33 #define SC_RSRVD_ES_VENDOR_LOCATION             "x.com.samsung.location"
34 #define SC_RSRVD_ES_VENDOR_CLIENTID             "x.com.samsung.clientid"
35 #define SC_RSRVD_ES_VENDOR_ACCOUNT              "x.com.samsung.account"
36 #define SC_RSRVD_ES_VENDOR_SSO_LIST            "x.com.samsung.ssolist"
37 #define SC_RSRVD_ES_VENDOR_ADDITIONAL_AUTH_CODE "x.com.samsung.aac"
38 #define SC_RSRVD_ES_VENDOR_ACCESS_TOKEN         "x.com.samsung.accesstoken"
39 #define SC_RSRVD_ES_VENDOR_REFRESH_TOKEN        "x.com.samsung.refreshtoken"
40 #define SC_RSRVD_ES_VENDOR_UTC_DATE_TIME        "x.com.samsung.datetime"
41 #define SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME   "x.com.samsung.regionaldatetime"
42 #define SC_RSRVD_ES_VENDOR_BSSID                "x.com.samsung.bssid"
43 #define SC_RSRVD_ES_VENDOR_USERID               "x.com.samsung.uid"
44 #define SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV  "x.com.samsung.rmd"
45 #define SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV     "x.com.samsung.rsd"
46 #define SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO    "x.com.samsung.npi"
47 #define SC_RSRVD_ES_VENDOR_TC_STATUS            "x.com.samsung.tcstatus"
48 #define SC_RSRVD_ES_VENDOR_TC_HEADER            "x.com.samsung.tcheader"
49 #define SC_RSRVD_ES_VENDOR_TC_VERSION           "x.com.samsung.tcversion"
50 #define SC_RSRVD_ES_VENDOR_TC_RESULT            "x.com.samsung.tcresult"
51 #define SC_RSRVD_ES_VENDOR_PNP_PIN              "x.com.samsung.pnppin"
52 #define SC_RSRVD_ES_VENDOR_MODEL_NUMBER         "x.com.samsung.modelnumber"
53 #define SC_RSRVD_ES_VENDOR_LANGUAGE             "x.com.samsung.language"
54 #define SC_RSRVD_ES_VENDOR_COUNTRY              "x.com.samsung.country"
55 #define SC_RSRVD_ES_VENDOR_GPSLOCATION          "x.com.samsung.gpslocation"
56 #define SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION  "x.com.samsung.espv"
57
58
59 namespace OIC
60 {
61     namespace Service
62     {
63
64         #define INVALID_DISCOVERY_CHANNEL -1
65
66         typedef enum
67         {
68             NET_STATE_INIT = -1,                /**< Init state **/
69             NET_STATE_WIRED_CONNECTED = 0,      /**< Wired connected **/
70             NET_STATE_WIRELESS_CONNECTED,       /**< Wireless connected **/
71             NET_STATE_NOT_CONNECTED             /**< Not connected, at all **/
72         } NETCONNECTION_STATE;
73
74         typedef enum
75         {
76             TC_STATUS_NOT_SUPPORTED = 0,
77             TC_STATUS_ALREADY_AGREED,
78             TC_STATUS_NEED_TO_AGREE,
79             TC_STATUS_DOWNLOADING_TC,
80             TC_STATUS_SUCCESS_TO_DOWNLOAD_TC,
81             TC_STATUS_FAIL_TO_DOWNLOAD_TC,
82             TC_STATUS_DISAGREED_WITH_TC,
83             TC_STATUS_GEO_BLOCKED,
84             TC_STATUS_TIMEOUT_TO_AGREE
85         } TC_STATUS;
86
87         /**
88          * @brief Properties of provisioning resource. It includes a provisioning status and last
89          *        error code.
90          */
91         class SCEnrolleeStatus : public EnrolleeStatus
92         {
93         public:
94             SCEnrolleeStatus(const EnrolleeStatus&& parent) : EnrolleeStatus(parent)
95             {
96             }
97
98             /**
99              * Get a network connection state property of Enrollee.
100              *
101              * @return a network connection state property of Enrollee.
102              */
103             NETCONNECTION_STATE getNetConnectionState() const
104             {
105                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
106                 {
107                     return static_cast<NETCONNECTION_STATE>
108                                     (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
109                 }
110                 return NETCONNECTION_STATE::NET_STATE_INIT;
111             }
112
113             /**
114              * Get T&C status
115              *
116              * @return T&C Status
117              *
118              * @see TC_STATUS
119              */
120             TC_STATUS getTCStatus()
121             {
122                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
123                 {
124                     return static_cast<TC_STATUS>
125                             (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
126                 }
127
128                 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
129             }
130         };
131
132         /**
133          * @brief Data class stored for Device property provisioning which includes a WiFi
134          *        and device configuration provisioning
135          */
136         class SCDeviceProp : public DeviceProp
137         {
138         public:
139
140             /**
141              * Set DevConf resource properties to be delivered to Enrollee
142              *
143              * @param language IETF language tag using ISO 639X
144              * @param country ISO Country Code (ISO 3166-1 Alpha-2)
145              * @param location location information
146              */
147             void setDevConfProp(string language, string country, string location)
148             {
149                 m_rep.setValue(SC_RSRVD_ES_VENDOR_LANGUAGE, language);
150                 m_rep.setValue(SC_RSRVD_ES_VENDOR_COUNTRY, country);
151                 m_rep.setValue(SC_RSRVD_ES_VENDOR_GPSLOCATION, location);
152             }
153
154             /**
155              * Get a language to be set. A language is expressed in IETF language tag
156              * using ISO 639X.
157              *
158              * @return a language to be set
159              */
160             std::string getLanguage() const
161             {
162                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE))
163                 {
164                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_LANGUAGE);
165                 }
166                 return std::string("");
167             }
168
169             /**
170              * Get a country to be set. A country is expressed in ISO Country Code
171              * (ISO 3166-1 Alpha-2)
172              *
173              * @return a country to be set
174              */
175             std::string getCountry() const
176             {
177                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY))
178                 {
179                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY);
180                 }
181                 return std::string("");
182             }
183
184             /**
185              * Get a location to be set. A location is GPS information
186              *
187              * @return a country to be set
188              */
189             std::string getLocation() const
190             {
191                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION))
192                 {
193                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_GPSLOCATION);
194                 }
195                 return std::string("");
196             }
197
198             /**
199              * Set discoveryChannel properties to be delivered to Enrollee
200              *
201              * @param discoveryChannel Channel of the Enroller for fast discover
202              */
203             void setDiscoveryChannel(int discoveryChannel)
204             {
205                 m_rep.setValue(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL, discoveryChannel);
206             }
207
208             /**
209              * Get an channel of Enroller
210              *
211              * @return an channel of enroller
212              */
213             int getDiscoveryChannel()
214             {
215                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL))
216                 {
217                     return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL);
218                 }
219                 return INVALID_DISCOVERY_CHANNEL;
220             }
221
222             /**
223              * Set samsung-specific location property to be delivered to Enrollee
224              *
225              * @param locations a set of location information
226              */
227             void setSCLocation(const std::vector<std::string> &locations)
228             {
229                 m_rep.setValue(SC_RSRVD_ES_VENDOR_LOCATION, locations);
230             }
231
232             /**
233              * Set samsung account property to be delivered to Enrollee (for TV)
234              *
235              * @param account a samsung account ID information (for TV)
236              */
237             void setSCAccount(const std::string &account)
238             {
239                 m_rep.setValue(SC_RSRVD_ES_VENDOR_ACCOUNT, account);
240             }
241
242             /**
243              * Set UTC date time property to be delivered to Enrollee.
244              * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
245              *
246              * @param datetime UTC date time
247              */
248             void setUTCDatetime(const std::string &datetime)
249             {
250                 m_rep.setValue(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME, datetime);
251             }
252
253             /**
254              * Get UTC date time property
255              *
256              * @return UTC date time
257              */
258             std::string getUTCDatetime()
259             {
260                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
261                 {
262                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
263                 }
264                 return {};
265             }
266
267             /**
268              * Set regional date time property to be delivered to Enrollee.
269              * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
270              *
271              * @param datetime Regional date time
272              */
273             void setRegionalDatetime(const std::string &datetime)
274             {
275                 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME, datetime);
276             }
277
278             /**
279              * Get regional date time property
280              *
281              * @return Date time
282              */
283             std::string getRegionalDatetime()
284             {
285                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
286                 {
287                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
288                 }
289                 return {};
290             }
291
292             /**
293              * Set Mobile device information used for 'register TV'
294              * The format is in json. The key indicates the meaning of value and the value is a
295              * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
296              * bm(BT MAC), dn(device name), dt(device type), it(icon type).
297              *
298              * @param regMobileDev register mobile device
299              */
300             void setRegisterMobileDevice(const std::string &regMobileDev)
301             {
302                 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV, regMobileDev);
303             }
304
305             /**
306              * Get Mobile device information used for 'register TV'
307              *
308              * @return register mobile device
309              */
310             std::string getRegisterMobileDevice()
311             {
312                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV))
313                 {
314                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV);
315                 }
316                 return {};
317             }
318
319             /**
320              * Set a BSSID of Enroller
321              *
322              * @param a BSSID of enroller
323              */
324             void setBSSID(const std::string &bssid)
325             {
326                 m_rep.setValue(SC_RSRVD_ES_VENDOR_BSSID, bssid);
327             }
328
329             /**
330              * Get a BSSID of Enroller
331              *
332              * @return a BSSID of enroller
333              */
334             std::string getBSSID()
335             {
336                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
337                 {
338                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
339                 }
340                 return {};
341             }
342
343             /**
344              * Set SSO list information
345              *
346              * @param  SSO list
347              */
348             void setSSOList(const std::string &ssoList)
349             {
350                 m_rep.setValue(SC_RSRVD_ES_VENDOR_SSO_LIST, ssoList);
351             }
352
353             /**
354              * Get SSO List information which is registered in device
355              *
356              * @return SSO List
357              */
358             std::string getSSOList()
359             {
360                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
361                 {
362                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
363                 }
364                 return {};
365             }
366         };
367
368         class SCCloudProp : public CloudProp
369         {
370             public:
371             /**
372              * Set samsung-specific client service ID property to be delivered to Enrollee
373              *
374              * @param clientID - Client service ID
375              */
376             void setClientID(const std::string &clientID)
377             {
378                 m_rep.setValue(SC_RSRVD_ES_VENDOR_CLIENTID, clientID);
379             }
380
381             /**
382              * Get samsung-specific client service ID property.
383              *
384              * @return Client service ID.
385              */
386             std::string getClientID()
387             {
388                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CLIENTID))
389                 {
390                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CLIENTID);
391                 }
392                 return {};
393             }
394
395             /**
396              * Set samsung-specific additional AuthCode property to be delivered to Enrollee (for TV/AV sign up VD SSO)
397              *
398              * @param additionalAuthcode - additional AuthCode (for TV/AV sign up VD SSO)
399              */
400             void setAdditionalAuthCode(const std::string &additionalAuthcode)
401             {
402                 m_rep.setValue(SC_RSRVD_ES_VENDOR_ADDITIONAL_AUTH_CODE, additionalAuthcode);
403             }
404
405             /**
406              * Set samsung-specific refresh token property to be delivered to Enrollee
407              *
408              * @param refreshtoken - Refresh token.
409              */
410             void setRefreshToken(const std::string &refreshtoken)
411             {
412                 m_rep.setValue(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN, refreshtoken);
413             }
414
415             /**
416              * Get samsung-specific refresh token property.
417              *
418              * @return refreshtoken - Refresh token.
419              */
420             std::string getRefreshToken()
421             {
422                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN))
423                 {
424                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN);
425                 }
426                 return {};
427             }
428
429             /**
430              * Set samsung-specific user ID property to be delivered to Enrollee
431              *
432              * @param uid - user ID.
433              */
434             void setUserID(const std::string &uid)
435             {
436                 m_rep.setValue(SC_RSRVD_ES_VENDOR_USERID, uid);
437             }
438
439             /**
440              * Get samsung-specific user ID property
441              *
442              * @return uid - user ID.
443              */
444             std::string getUserID()
445             {
446                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_USERID))
447                 {
448                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_USERID);
449                 }
450                 return {};
451             }
452
453             /**
454              * Set T&C Result
455              * Indicates T&C result by mobile user in json format.
456              *
457              * @param uid - user ID.
458              */
459             void setTCResult(const std::string &result)
460             {
461                 m_rep.setValue(SC_RSRVD_ES_VENDOR_TC_RESULT, result);
462             }
463
464             /**
465              * Get T&C Result
466              *
467              * @return uid - user ID.
468              */
469             std::string getTCResult()
470             {
471                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_RESULT))
472                 {
473                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_RESULT);
474                 }
475                 return {};
476             }
477         };
478
479         /**
480          * @breif This provide a set of getter APIs from received response for getConfiguration().
481          *        Received information includes a device name, WiFi supported mode, and frequency.
482          *        Additionally, you can know if Enrollee can be access to cloud server with this
483          *        object.
484          */
485         class SCEnrolleeConf : public EnrolleeConf
486         {
487         public:
488             SCEnrolleeConf(const EnrolleeConf&& parent) : EnrolleeConf(parent)
489             {
490             }
491
492             /**
493              * Get a model number of Enrollee.
494              *
495              * @return a model number of Enrollee
496              */
497             std::string getModelNumber() const
498             {
499                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
500                 for(auto child = children.begin(); child != children.end(); ++child)
501                 {
502                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
503                     {
504                         OCRepresentation rep;
505                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
506                         {
507                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
508                         }
509                         else
510                         {
511                             return std::string("");
512                         }
513
514                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER))
515                         {
516                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_MODEL_NUMBER);
517                         }
518                     }
519                 }
520                 return std::string("");
521             }
522
523             /**
524              * Get a device type of Enrollee.
525              * It is Device's human-friendly name like device model name.
526              *
527              * @return a device type of Enrollee
528              */
529             std::string getDeviceType() const
530             {
531                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
532                 for(auto child = children.begin(); child != children.end(); ++child)
533                 {
534                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
535                     {
536                         OCRepresentation rep;
537                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
538                         {
539                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
540                         }
541                         else
542                         {
543                             return std::string("");
544                         }
545
546                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_TYPE))
547                         {
548                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_TYPE);
549                         }
550                     }
551                 }
552                 return std::string("");
553             }
554
555             /**
556              * Get a device sub-type of Enrollee.
557              * It is Device's human-friendly name like device model name.
558              *
559              * @return a device sub-type of Enrollee
560              */
561             std::string getDeviceSubType() const
562             {
563                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
564                 for(auto child = children.begin(); child != children.end(); ++child)
565                 {
566                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
567                     {
568                         OCRepresentation rep;
569                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
570                         {
571                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
572                         }
573                         else
574                         {
575                             return std::string("");
576                         }
577
578                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE))
579                         {
580                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE);
581                         }
582                     }
583                 }
584                 return std::string("");
585             }
586
587             /**
588              * Get Set device information used for 'register TV'
589              * The format is in json. The key indicates the meaning of value and the value is a
590              * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
591              * bm(BT MAC), rt(Remote Type)
592              *
593              * @return Register Set Device
594              */
595             std::string getRegisterSetDevice() const
596             {
597                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
598                 for(auto child = children.begin(); child != children.end(); ++child)
599                 {
600                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
601                     {
602                         OCRepresentation rep;
603                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
604                         {
605                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
606                         }
607                         else
608                         {
609                             return std::string("");
610                         }
611
612                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV))
613                         {
614                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV);
615                         }
616                     }
617                 }
618                 return std::string("");
619             }
620
621             /**
622              * Get network provisioning information for the device.
623              * Mediator can use this information to enquire & validate registration status with corresponding Network Vendor.
624              * The format is in JSON. The key indicates the meaning of value and the value is a
625              * corresponding information. Supported keys include: IMEI (IMEI Number), IMSI (IMSI Number),
626              * MCC_MNC(MCC & MNC Number), SN(Serial Number)
627              *
628              * @return Network Provisioning Information String.
629              */
630             std::string getNetworkProvisioningInfo() const
631             {
632                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
633                 for(auto child = children.begin(); child != children.end(); ++child)
634                 {
635                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
636                     {
637                         OCRepresentation rep;
638                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
639                         {
640                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
641                         }
642                         else
643                         {
644                             return std::string("");
645                         }
646
647                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO))
648                         {
649                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO);
650                         }
651                     }
652                 }
653                 return std::string("");
654             }
655
656             /**
657              * Get SSO List information for the device.
658              * The format is in JSON. The key indicates the meaning of value and the value is a
659              * corresponding information. Supported keys include: Available Count , Registered Count,
660              * Account List
661              *
662              * @return SSo List Information String.
663              */
664             std::string getSSOList() const
665             {
666                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
667                 for(auto child = children.begin(); child != children.end(); ++child)
668                 {
669                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
670                     {
671                         OCRepresentation rep;
672                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
673                         {
674                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
675                         }
676                         else
677                         {
678                             return std::string("");
679                         }
680
681                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
682                         {
683                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
684                         }
685                     }
686                 }
687                 return std::string("");
688             }
689
690             /**
691              * Get T&C status
692              * Indicates T&C is already agreed or not.
693              *
694              * @return T&C Status
695              *
696              * @see TC_STATUS
697              */
698             TC_STATUS getTCStatus()
699             {
700                 OCRepresentation rep;
701                 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
702                 {
703                     rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
704                 }
705                 else
706                 {
707                     return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
708                 }
709
710                 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
711                 {
712                     return static_cast<TC_STATUS>
713                             (rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
714                 }
715
716                 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
717             }
718
719             /**
720              * Get T&C Header
721              * T&C Header Information in json format
722              *
723              * @return T&C Header
724              */
725             std::string getTCHeader()
726             {
727                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
728                 for(auto child = children.begin(); child != children.end(); ++child)
729                 {
730                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
731                     {
732                         OCRepresentation rep;
733                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
734                         {
735                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
736                         }
737                         else
738                         {
739                             return std::string("");
740                         }
741
742                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_HEADER))
743                         {
744                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_HEADER);
745                         }
746                     }
747                 }
748                 return std::string("");
749             }
750
751             /**
752              * Get T&C Version
753              *
754              * @return T&C Version
755              */
756             std::string getTCVersion()
757             {
758                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
759                 for(auto child = children.begin(); child != children.end(); ++child)
760                 {
761                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
762                     {
763                         OCRepresentation rep;
764                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
765                         {
766                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
767                         }
768                         else
769                         {
770                             return std::string("");
771                         }
772
773                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_VERSION))
774                         {
775                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_VERSION);
776                         }
777                     }
778                 }
779                 return std::string("");
780             }
781
782             /**
783              * Get PnP Pin
784              *
785              * @return PnP Pin
786              */
787             std::string getPnpPin() const
788             {
789                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
790                 for(auto child = children.begin(); child != children.end(); ++child)
791                 {
792                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
793                     {
794                         OCRepresentation rep;
795                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
796                         {
797                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
798                         }
799                         else
800                         {
801                             return std::string("");
802                         }
803
804                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_PNP_PIN))
805                         {
806                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PNP_PIN);
807                         }
808                     }
809                 }
810                 return std::string("");
811             }
812
813             /**
814              * Get a network connection state property of Enrollee.
815              *
816              * @return a network connection state property of Enrollee.
817              */
818             NETCONNECTION_STATE getNetConnectionState() const
819             {
820                 OCRepresentation rep;
821                 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
822                 {
823                     rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
824                 }
825                 else
826                 {
827                     return NETCONNECTION_STATE::NET_STATE_INIT;
828                 }
829
830                 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
831                 {
832                     return static_cast<NETCONNECTION_STATE>
833                                     (rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
834                 }
835
836                 return NETCONNECTION_STATE::NET_STATE_INIT;
837             }
838
839             /**
840              * Get a BSSID of Enroller
841              *
842              * @return a BSSID of enroller
843              */
844             std::string getBSSID() const
845             {
846                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
847                 for(auto child = children.begin(); child != children.end(); ++child)
848                 {
849                     if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
850                     {
851                         OCRepresentation rep;
852                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
853                         {
854                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
855                         }
856                         else
857                         {
858                             return std::string("");
859                         }
860
861                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
862                         {
863                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
864                         }
865                     }
866                 }
867                 return {};
868             }
869
870             /**
871              * Get UTC date time
872              *
873              * @return UTC date time
874              */
875             std::string getUTCDatetime() const
876             {
877                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
878                 for(auto child = children.begin(); child != children.end(); ++child)
879                 {
880                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
881                     {
882                         OCRepresentation rep;
883                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
884                         {
885                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
886                         }
887                         else
888                         {
889                             return std::string("");
890                         }
891
892                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
893                         {
894                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
895                         }
896                     }
897                 }
898                 return {};
899             }
900
901             /**
902              * Get regional date time
903              *
904              * @return date time
905              */
906             std::string getRegionalDatetime() const
907             {
908                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
909                 for(auto child = children.begin(); child != children.end(); ++child)
910                 {
911                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
912                     {
913                         OCRepresentation rep;
914                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
915                         {
916                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
917                         }
918                         else
919                         {
920                             return std::string("");
921                         }
922
923                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
924                         {
925                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
926                         }
927                     }
928                 }
929                 return {};
930             }
931
932             /**
933              * Get Samsung Easy Setup Protocol Version.
934              *
935              * Mediator can use this API to differentiate between Easy Setup Protcol supported by
936              * Samsung Enrollee Devices.
937              *
938              * Example: Version Value for Tizen4.0: [\932.0\94]
939              *
940              * @return Easy Setup Protocol Version String.
941              */
942             std::string getESProtocolVersion() const
943             {
944                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
945                 for(auto child = children.begin(); child != children.end(); ++child)
946                 {
947                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
948                     {
949                         OCRepresentation rep;
950                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
951                         {
952                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
953                         }
954                         else
955                         {
956                             return std::string("");
957                         }
958
959                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION))
960                         {
961                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION);
962                         }
963                     }
964                 }
965                 return std::string("");
966             }
967
968         };
969     }
970 }
971
972 #endif //ESSC_COMMON_RICH_H_