Modified additional field
[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_SA_API_SERVER        "x.com.samsung.saapiserver"
39 #define SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER       "x.com.samsung.saauthserver"
40 #define SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE "x.com.samsung.sadsc"
41 #define SC_RSRVD_ES_VENDOR_ACCESS_TOKEN         "x.com.samsung.accesstoken"
42 #define SC_RSRVD_ES_VENDOR_REFRESH_TOKEN        "x.com.samsung.refreshtoken"
43 #define SC_RSRVD_ES_VENDOR_UTC_DATE_TIME        "x.com.samsung.datetime"
44 #define SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME   "x.com.samsung.regionaldatetime"
45 #define SC_RSRVD_ES_VENDOR_BSSID                "x.com.samsung.bssid"
46 #define SC_RSRVD_ES_VENDOR_USERID               "x.com.samsung.uid"
47 #define SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV  "x.com.samsung.rmd"
48 #define SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV     "x.com.samsung.rsd"
49 #define SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO    "x.com.samsung.npi"
50 #define SC_RSRVD_ES_VENDOR_TC_STATUS            "x.com.samsung.tcstatus"
51 #define SC_RSRVD_ES_VENDOR_TC_HEADER            "x.com.samsung.tcheader"
52 #define SC_RSRVD_ES_VENDOR_TC_VERSION           "x.com.samsung.tcversion"
53 #define SC_RSRVD_ES_VENDOR_TC_RESULT            "x.com.samsung.tcresult"
54 #define SC_RSRVD_ES_VENDOR_PNP_PIN              "x.com.samsung.pnppin"
55 #define SC_RSRVD_ES_VENDOR_MODEL_NUMBER         "x.com.samsung.modelnumber"
56 #define SC_RSRVD_ES_VENDOR_LANGUAGE             "x.com.samsung.language"
57 #define SC_RSRVD_ES_VENDOR_COUNTRY              "x.com.samsung.country"
58 #define SC_RSRVD_ES_VENDOR_GPSLOCATION          "x.com.samsung.gpslocation"
59 #define SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION  "x.com.samsung.espv"
60 #define SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD     "mnmo"
61 #define SC_RSRVD_ES_VENDOR_LANGUAGE_OLD         "lang"
62 #define SC_RSRVD_ES_VENDOR_COUNTRY_OLD          "ctry"
63 #define SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD      "loc"
64 #define SC_RSRVD_ES_VENDOR_SERVER_ID            "x.com.samsung.serverid"
65 #define SC_RSRVD_ES_VENDOR_TIMEZONE_ID          "x.com.samsung.timezoneid"
66 #define SC_RSRVD_ES_VENDOR_HIDDEN               "x.com.samsung.hidden"
67 #define SC_RSRVD_ES_VENDOR_HUB_ID               "x.com.samsung.hubid"
68 #define SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT   "x.com.samsung.deployenv"
69 #define SC_RSRVD_ES_VENDOR_IATT                 "x.com.samsung.iatt"
70 #define SC_RSRVD_ES_VENDOR_CANDIDATEAPS         "x.com.samsung.candidateaps"
71 #define SC_RSRVD_ES_VENDOR_CANDIDATE_SSID       "ssid"
72 #define SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE "passphrase"
73 #define SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL    "channel"
74 #define SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID      "bssid"
75
76 namespace OIC
77 {
78     namespace Service
79     {
80
81         #define INVALID_DISCOVERY_CHANNEL -1
82
83         typedef enum
84         {
85             NET_STATE_INIT = -1,                /**< Init state **/
86             NET_STATE_WIRED_CONNECTED = 0,      /**< Wired connected **/
87             NET_STATE_WIRELESS_CONNECTED,       /**< Wireless connected **/
88             NET_STATE_NOT_CONNECTED             /**< Not connected, at all **/
89         } NETCONNECTION_STATE;
90
91         typedef enum
92         {
93             TC_STATUS_NOT_SUPPORTED = 0,
94             TC_STATUS_ALREADY_AGREED,
95             TC_STATUS_NEED_TO_AGREE,
96             TC_STATUS_DOWNLOADING_TC,
97             TC_STATUS_SUCCESS_TO_DOWNLOAD_TC,
98             TC_STATUS_FAIL_TO_DOWNLOAD_TC,
99             TC_STATUS_DISAGREED_WITH_TC,
100             TC_STATUS_GEO_BLOCKED,
101             TC_STATUS_TIMEOUT_TO_AGREE
102         } TC_STATUS;
103
104         typedef struct SCCandidateAPInfo
105         {
106             std::string ssid;
107             std::string passphrase;
108             int channel;
109             std::string bssid;
110         } SCCandidateAPInfo;
111
112         /**
113          * @brief Properties of provisioning resource. It includes a provisioning status and last
114          *        error code.
115          */
116         class SCEnrolleeStatus : public EnrolleeStatus
117         {
118         public:
119             SCEnrolleeStatus(const EnrolleeStatus&& parent) : EnrolleeStatus(parent)
120             {
121             }
122
123             /**
124              * Get a network connection state property of Enrollee.
125              *
126              * @return a network connection state property of Enrollee.
127              */
128             NETCONNECTION_STATE getNetConnectionState() const
129             {
130                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
131                 {
132                     return static_cast<NETCONNECTION_STATE>
133                                     (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
134                 }
135                 return NETCONNECTION_STATE::NET_STATE_INIT;
136             }
137
138             /**
139              * Get T&C status
140              *
141              * @return T&C Status
142              *
143              * @see TC_STATUS
144              */
145             TC_STATUS getTCStatus()
146             {
147                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
148                 {
149                     return static_cast<TC_STATUS>
150                             (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
151                 }
152
153                 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
154             }
155         };
156
157         /**
158          * @brief Data class stored for Device property provisioning which includes a WiFi
159          *        and device configuration provisioning
160          */
161         class SCDeviceProp : public DeviceProp
162         {
163         public:
164
165             /**
166              * Set DevConf resource properties to be delivered to Enrollee
167              *
168              * @param language IETF language tag using ISO 639X
169              * @param country ISO Country Code (ISO 3166-1 Alpha-2)
170              * @param location location information
171              */
172             void setDevConfProp(string language, string country, string location)
173             {
174                 m_rep.setValue(SC_RSRVD_ES_VENDOR_LANGUAGE, language);
175                 m_rep.setValue(SC_RSRVD_ES_VENDOR_COUNTRY, country);
176                 m_rep.setValue(SC_RSRVD_ES_VENDOR_GPSLOCATION, location);
177
178                 /* [CONPRO-888] Support backward compatibility */
179                 m_rep.setValue(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD, language);
180                 m_rep.setValue(SC_RSRVD_ES_VENDOR_COUNTRY_OLD, country);
181                 m_rep.setValue(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD, location);
182             }
183
184             /**
185              * Get a language to be set. A language is expressed in IETF language tag
186              * using ISO 639X.
187              *
188              * @return a language to be set
189              */
190             std::string getLanguage() const
191             {
192                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE))
193                 {
194                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_LANGUAGE);
195                 }
196                 else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD))
197                 {
198                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD);
199                 }
200                 return std::string("");
201             }
202
203             /**
204              * Get a country to be set. A country is expressed in ISO Country Code
205              * (ISO 3166-1 Alpha-2)
206              *
207              * @return a country to be set
208              */
209             std::string getCountry() const
210             {
211                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY))
212                 {
213                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY);
214                 }
215                 else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY_OLD))
216                 {
217                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY_OLD);
218                 }
219                 return std::string("");
220             }
221
222             /**
223              * Get a location to be set. A location is GPS information
224              *
225              * @return a country to be set
226              */
227             std::string getLocation() const
228             {
229                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION))
230                 {
231                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_GPSLOCATION);
232                 }
233                 else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD))
234                 {
235                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD);
236                 }
237                 return std::string("");
238             }
239
240             /**
241              * Set discoveryChannel properties to be delivered to Enrollee
242              *
243              * @param discoveryChannel Channel of the Enroller for fast discover
244              */
245             void setDiscoveryChannel(int discoveryChannel)
246             {
247                 m_rep.setValue(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL, discoveryChannel);
248             }
249
250             /**
251              * Get an channel of Enroller
252              *
253              * @return an channel of enroller
254              */
255             int getDiscoveryChannel()
256             {
257                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL))
258                 {
259                     return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL);
260                 }
261                 return INVALID_DISCOVERY_CHANNEL;
262             }
263
264             /**
265              * Set samsung-specific location property to be delivered to Enrollee
266              *
267              * @param locations a set of location information
268              */
269             void setSCLocation(const std::vector<std::string> &locations)
270             {
271                 m_rep.setValue(SC_RSRVD_ES_VENDOR_LOCATION, locations);
272             }
273
274             /**
275              * Set samsung account property to be delivered to Enrollee (for TV)
276              *
277              * @param account a samsung account ID information (for TV)
278              */
279             void setSCAccount(const std::string &account)
280             {
281                 m_rep.setValue(SC_RSRVD_ES_VENDOR_ACCOUNT, account);
282             }
283
284             /**
285              * Set UTC date time property to be delivered to Enrollee.
286              * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
287              *
288              * @param datetime UTC date time
289              */
290             void setUTCDatetime(const std::string &datetime)
291             {
292                 m_rep.setValue(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME, datetime);
293             }
294
295             /**
296              * Get UTC date time property
297              *
298              * @return UTC date time
299              */
300             std::string getUTCDatetime()
301             {
302                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
303                 {
304                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
305                 }
306                 return {};
307             }
308
309             /**
310              * Set regional date time property to be delivered to Enrollee.
311              * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
312              *
313              * @param datetime Regional date time
314              */
315             void setRegionalDatetime(const std::string &datetime)
316             {
317                 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME, datetime);
318             }
319
320             /**
321              * Get regional date time property
322              *
323              * @return Date time
324              */
325             std::string getRegionalDatetime()
326             {
327                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
328                 {
329                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
330                 }
331                 return {};
332             }
333
334             /**
335              * Set Mobile device information used for 'register TV'
336              * The format is in json. The key indicates the meaning of value and the value is a
337              * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
338              * bm(BT MAC), dn(device name), dt(device type), it(icon type).
339              *
340              * @param regMobileDev register mobile device
341              */
342             void setRegisterMobileDevice(const std::string &regMobileDev)
343             {
344                 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV, regMobileDev);
345             }
346
347             /**
348              * Get Mobile device information used for 'register TV'
349              *
350              * @return register mobile device
351              */
352             std::string getRegisterMobileDevice()
353             {
354                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV))
355                 {
356                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV);
357                 }
358                 return {};
359             }
360
361             /**
362              * Set a BSSID of Enroller
363              *
364              * @param a BSSID of enroller
365              */
366             void setBSSID(const std::string &bssid)
367             {
368                 m_rep.setValue(SC_RSRVD_ES_VENDOR_BSSID, bssid);
369             }
370
371             /**
372              * Get a BSSID of Enroller
373              *
374              * @return a BSSID of enroller
375              */
376             std::string getBSSID()
377             {
378                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
379                 {
380                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
381                 }
382                 return {};
383             }
384
385             /**
386              * Set SSO list information
387              *
388              * @param  SSO list
389              */
390             void setSSOList(const std::string &ssoList)
391             {
392                 m_rep.setValue(SC_RSRVD_ES_VENDOR_SSO_LIST, ssoList);
393             }
394
395             /**
396              * Get SSO List information which is registered in device
397              *
398              * @return SSO List
399              */
400             std::string getSSOList()
401             {
402                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
403                 {
404                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
405                 }
406                 return {};
407             }
408
409              /**
410              * Set Candidate AP information which is stored.
411              *
412              * @param clientID - Client service ID
413              */
414             void setCandidateAPList(SCCandidateAPInfo *candidateInfo,int numCandidateAP)
415             {
416                 std::vector<OC::OCRepresentation> candidateAPList;
417                 for (int i=0;i<numCandidateAP;i++)
418                 {
419                             OCRepresentation candidateListInfo;
420                             candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID, candidateInfo[i].bssid);
421                             candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL, candidateInfo[i].channel);
422                             candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE, candidateInfo[i].passphrase);
423                             candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID, candidateInfo[i].ssid);
424                             candidateAPList.push_back(candidateListInfo);
425                 }
426                 m_rep.setValue(SC_RSRVD_ES_VENDOR_CANDIDATEAPS, candidateAPList);
427             }
428
429              /**
430              * Get Candidate AP information which is registered in device.
431              *
432              * @return SCCandidateAPInfo list.
433              */
434             std::vector<SCCandidateAPInfo> getCandidateAPList()
435             {
436                 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
437                 {
438                     std::vector<OC::OCRepresentation> candidateInfo=
439                                 m_rep.getValue<std::vector<OC::OCRepresentation>>(SC_RSRVD_ES_VENDOR_CANDIDATEAPS);
440                     std::vector<SCCandidateAPInfo> postcandidateInfo;
441                     for(std::vector<OC::OCRepresentation>::iterator it = candidateInfo.begin();
442                               it != candidateInfo.end(); ++it)
443                     {
444                         OC::OCRepresentation rep = *it;
445                         SCCandidateAPInfo candidateInfotemp;
446                         if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID))
447                         {
448                             candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID);
449                         }
450                         if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE))
451                         {
452                             candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE);
453                         }
454                         if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
455                         {
456                             candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
457
458                         }
459                         if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID))
460                         {
461                             candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID);
462                         }
463                         postcandidateInfo.push_back(candidateInfotemp);
464                     }
465                     return postcandidateInfo;
466                 }
467                 return {};
468             }
469
470             /**
471              * Set time zone for location based services when easy-setup is done
472              *
473              * @param Name of timeZone
474              */
475             void setTimeZoneId(const std::string &timeZoneId)
476             {
477                 m_rep.setValue(SC_RSRVD_ES_VENDOR_TIMEZONE_ID, timeZoneId);
478             }
479
480             /**
481              * Get the Name of TimeZone
482              *
483              * @return Name of timeZone
484              */
485             std::string getTimeZoneId()
486             {
487                 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TIMEZONE_ID))
488                 {
489                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TIMEZONE_ID);
490                 }
491                 return {};
492             }
493
494             /**
495              * Sets the hidden property of wifi
496              * if the Value is true, wifi is a hidden wifi, otherwise it is not
497              *
498              * @param isHidden: value indicating whether the wifi is hidden or not
499              */
500             void setHiddenProperty(bool isHidden)
501             {
502                 m_rep.setValue(SC_RSRVD_ES_VENDOR_HIDDEN, isHidden);
503             }
504
505             /**
506              * Gets the property of the wifi whether it is hidden or not
507              *
508              * @return hidden value indicating whether the wifi is hidden or not
509              */
510             bool getHiddenProperty()
511             {
512                 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_HIDDEN))
513                 {
514                     return m_rep.getValue<bool>(SC_RSRVD_ES_VENDOR_HIDDEN);
515                 }
516                 return false;
517             }
518         };
519
520         class SCCloudProp : public CloudProp
521         {
522             public:
523             /**
524              * Set samsung-specific client service ID property to be delivered to Enrollee
525              *
526              * @param clientID - Client service ID
527              */
528             void setClientID(const std::string &clientID)
529             {
530                 m_rep.setValue(SC_RSRVD_ES_VENDOR_CLIENTID, clientID);
531             }
532
533             /**
534              * Get samsung-specific client service ID property.
535              *
536              * @return Client service ID.
537              */
538             std::string getClientID()
539             {
540                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CLIENTID))
541                 {
542                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CLIENTID);
543                 }
544                 return {};
545             }
546
547             /**
548              * Set samsung-specific additional AuthCode property to be delivered to Enrollee (for TV/AV sign up VD SSO)
549              *
550              * @param additionalAuthcode - additional AuthCode (for TV/AV sign up VD SSO)
551              */
552             void setAdditionalAuthCode(const std::string &additionalAuthcode)
553             {
554                 m_rep.setValue(SC_RSRVD_ES_VENDOR_ADDITIONAL_AUTH_CODE, additionalAuthcode);
555             }
556
557             /**
558              * Set samsung-specific additional Api provider to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO)
559              *
560              * @param additionalApiProvider - additional Api Provider
561              */
562             void setAdditionalApiProvider(const std::string &additionalApiProvider)
563             {
564                 m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_API_SERVER, additionalApiProvider);
565             }
566
567             /**
568              * Get samsung-specific additional Api provider (for devices(TV/AV, Lux) sign up SSO)
569              *
570              * @return additionalApiProvider - additional Api Provider
571              */
572             std::string getAdditionalApiProvider()
573             {
574                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_API_SERVER))
575                 {
576                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SA_API_SERVER);
577                 }
578                 return {};
579             }
580
581             /**
582              * Set samsung-specific additional Auth provider to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO)
583              *
584              * @param additionalAuthProvider - additional Auth Provider
585              */
586             void setAdditionalAuthProvider(const std::string &additionalAuthProvider)
587             {
588                 m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER, additionalAuthProvider);
589             }
590
591             /**
592              * Get samsung-specific additional Auth provider (for devices(TV/AV, Lux) sign up SSO)
593              *
594              * @return additionalAuthProvider - additional Auth Provider
595              */
596             std::string getAdditionalAuthProvider()
597             {
598                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER))
599                 {
600                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER);
601                 }
602                 return {};
603             }
604
605             /**
606              * Set samsung-specific additional device security code to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO)
607              *
608              * @param additionalDeviceSecCode - additional DeviceSecurityCode (for devices(TV/AV, Lux) sign up VD SSO)
609              */
610             void setAdditionalDeviceSecCode(const std::string &additionalDeviceSecCode)
611             {
612                 m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE, additionalDeviceSecCode);
613             }
614
615             /**
616              * Get samsung-specific additional device security code
617              *
618              * @return additionalDeviceSecCode - additional DeviceSecurityCode
619              */
620             std::string getAdditionalDeviceSecCode()
621             {
622                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE))
623                 {
624                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE);
625                 }
626                 return {};
627             }
628
629             /**
630              * Set current deployment environment which IoT Server is operating such as "PRD" "STG"
631              *
632              * @param serverDeploymentEnv - current server Deployment Environment
633              */
634             void setServerDeploymentEnv(const std::string &serverDeploymentEnv)
635             {
636                 m_rep.setValue(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT, serverDeploymentEnv);
637             }
638
639             /**
640              * Get current server deployment environment which IoT Server is operating such as "PRD", "STG" etc
641              *
642              * @return serverDeploymentEnv - current server deployment environment
643              */
644             std::string getServerDeploymentEnv()
645             {
646                 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT))
647                 {
648                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT);
649                 }
650                 return {};
651             }
652
653             /**
654              * Set Access token type.
655              *
656              * @param type - Access token type
657              */
658             void setAccessTokenType(const int type)
659             {
660                 m_rep.setValue(SC_RSRVD_ES_VENDOR_IATT, type);
661             }
662
663             /**
664              * Get Access token type.
665              *
666              * @return Access token type.
667              */
668             int getAccessTokenType(void)
669             {
670                 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_IATT))
671                 {
672                     return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_IATT);
673                 }
674                 return 0;
675             }
676
677             /**
678              * Set samsung-specific refresh token property to be delivered to Enrollee
679              *
680              * @param refreshtoken - Refresh token.
681              */
682             void setRefreshToken(const std::string &refreshtoken)
683             {
684                 m_rep.setValue(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN, refreshtoken);
685             }
686
687             /**
688              * Get samsung-specific refresh token property.
689              *
690              * @return refreshtoken - Refresh token.
691              */
692             std::string getRefreshToken()
693             {
694                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN))
695                 {
696                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN);
697                 }
698                 return {};
699             }
700
701             /**
702              * Set samsung-specific user ID property to be delivered to Enrollee
703              *
704              * @param uid - user ID.
705              */
706             void setUserID(const std::string &uid)
707             {
708                 m_rep.setValue(SC_RSRVD_ES_VENDOR_USERID, uid);
709             }
710
711             /**
712              * Get samsung-specific user ID property
713              *
714              * @return uid - user ID.
715              */
716             std::string getUserID()
717             {
718                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_USERID))
719                 {
720                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_USERID);
721                 }
722                 return {};
723             }
724
725             /**
726              * Set T&C Result
727              * Indicates T&C result by mobile user in json format.
728              *
729              * @param uid - user ID.
730              */
731             void setTCResult(const std::string &result)
732             {
733                 m_rep.setValue(SC_RSRVD_ES_VENDOR_TC_RESULT, result);
734             }
735
736             /**
737              * Get T&C Result
738              *
739              * @return uid - user ID.
740              */
741             std::string getTCResult()
742             {
743                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_RESULT))
744                 {
745                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_RESULT);
746                 }
747                 return {};
748             }
749
750             /**
751              * Set samsung-specific client service ID property to be delivered to Enrollee
752              *
753              * @param clientID - Client service ID
754              */
755             void setServerId(const std::string &serverId)
756             {
757                 m_rep.setValue(SC_RSRVD_ES_VENDOR_SERVER_ID, serverId);
758             }
759
760             /**
761              * Get samsung-specific client service ID property.
762              *
763              * @return Client service ID.
764              */
765             std::string getServerId()
766             {
767                 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SERVER_ID))
768                 {
769                     return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SERVER_ID);
770                 }
771                 return {};
772             }
773         };
774
775         /**
776          * @breif This provide a set of getter APIs from received response for getConfiguration().
777          *        Received information includes a device name, WiFi supported mode, and frequency.
778          *        Additionally, you can know if Enrollee can be access to cloud server with this
779          *        object.
780          */
781         class SCEnrolleeConf : public EnrolleeConf
782         {
783         public:
784             SCEnrolleeConf(const EnrolleeConf&& parent) : EnrolleeConf(parent)
785             {
786             }
787
788             /**
789              * Get a model number of Enrollee.
790              *
791              * @return a model number of Enrollee
792              */
793             std::string getModelNumber() const
794             {
795                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
796                 for(auto child = children.begin(); child != children.end(); ++child)
797                 {
798                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
799                     {
800                         OCRepresentation rep;
801                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
802                         {
803                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
804                         }
805                         else
806                         {
807                             return std::string("");
808                         }
809
810                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER))
811                         {
812                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_MODEL_NUMBER);
813                         }
814                         else if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD))
815                         {
816                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD);
817                         }
818                     }
819                 }
820                 return std::string("");
821             }
822
823             /**
824              * Get a device type of Enrollee.
825              * It is Device's human-friendly name like device model name.
826              *
827              * @return a device type of Enrollee
828              */
829             std::string getDeviceType() const
830             {
831                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
832                 for(auto child = children.begin(); child != children.end(); ++child)
833                 {
834                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
835                     {
836                         OCRepresentation rep;
837                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
838                         {
839                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
840                         }
841                         else
842                         {
843                             return std::string("");
844                         }
845
846                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_TYPE))
847                         {
848                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_TYPE);
849                         }
850                     }
851                 }
852                 return std::string("");
853             }
854
855             /**
856              * Get a device sub-type of Enrollee.
857              * It is Device's human-friendly name like device model name.
858              *
859              * @return a device sub-type of Enrollee
860              */
861             std::string getDeviceSubType() const
862             {
863                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
864                 for(auto child = children.begin(); child != children.end(); ++child)
865                 {
866                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
867                     {
868                         OCRepresentation rep;
869                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
870                         {
871                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
872                         }
873                         else
874                         {
875                             return std::string("");
876                         }
877
878                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE))
879                         {
880                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE);
881                         }
882                     }
883                 }
884                 return std::string("");
885             }
886
887             /**
888              * Get Set device information used for 'register TV'
889              * The format is in json. The key indicates the meaning of value and the value is a
890              * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
891              * bm(BT MAC), rt(Remote Type)
892              *
893              * @return Register Set Device
894              */
895             std::string getRegisterSetDevice() const
896             {
897                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
898                 for(auto child = children.begin(); child != children.end(); ++child)
899                 {
900                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
901                     {
902                         OCRepresentation rep;
903                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
904                         {
905                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
906                         }
907                         else
908                         {
909                             return std::string("");
910                         }
911
912                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV))
913                         {
914                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV);
915                         }
916                     }
917                 }
918                 return std::string("");
919             }
920
921             /**
922             * Get Candidate AP information which is registered in device.
923             *
924             * @return SCCandidateAPInfo list.
925             */
926             std::vector<SCCandidateAPInfo> getCandidateAPList() const
927             {
928                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
929                 for(auto child = children.begin(); child != children.end(); ++child)
930                 {
931                     if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
932                     {
933                         OCRepresentation rep;
934                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
935                         {
936                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
937                         }
938
939                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
940                         {
941                             std::vector<OC::OCRepresentation> candidateInfo=rep.getValue<std::vector<OC::OCRepresentation>>(SC_RSRVD_ES_VENDOR_CANDIDATEAPS);
942                             std::vector<SCCandidateAPInfo> postcandidateInfo;
943                             for(std::vector<OC::OCRepresentation>::iterator it = candidateInfo.begin();
944                                       it != candidateInfo.end(); ++it)
945                             {
946                                 OC::OCRepresentation rep = *it;
947                                 SCCandidateAPInfo candidateInfotemp;
948                                 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID))
949                                 {
950                                     candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID);
951                                 }
952                                 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE))
953                                 {
954                                     candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE);
955                                 }
956                                 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
957                                 {
958                                     candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
959
960                                 }
961                                 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID))
962                                 {
963                                     candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID);
964                                 }
965                                 postcandidateInfo.push_back(candidateInfotemp);
966                             }
967                             return postcandidateInfo;
968                         }
969                     }
970                 }
971                 return {};
972             }
973
974             /**
975              * Get network provisioning information for the device.
976              * Mediator can use this information to enquire & validate registration status with corresponding Network Vendor.
977              * The format is in JSON. The key indicates the meaning of value and the value is a
978              * corresponding information. Supported keys include: IMEI (IMEI Number), IMSI (IMSI Number),
979              * MCC_MNC(MCC & MNC Number), SN(Serial Number)
980              *
981              * @return Network Provisioning Information String.
982              */
983             std::string getNetworkProvisioningInfo() const
984             {
985                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
986                 for(auto child = children.begin(); child != children.end(); ++child)
987                 {
988                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
989                     {
990                         OCRepresentation rep;
991                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
992                         {
993                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
994                         }
995                         else
996                         {
997                             return std::string("");
998                         }
999
1000                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO))
1001                         {
1002                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO);
1003                         }
1004                     }
1005                 }
1006                 return std::string("");
1007             }
1008
1009             /**
1010              * Get SSO List information for the device.
1011              * The format is in JSON. The key indicates the meaning of value and the value is a
1012              * corresponding information. Supported keys include: Available Count , Registered Count,
1013              * Account List
1014              *
1015              * @return SSo List Information String.
1016              */
1017             std::string getSSOList() const
1018             {
1019                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1020                 for(auto child = children.begin(); child != children.end(); ++child)
1021                 {
1022                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1023                     {
1024                         OCRepresentation rep;
1025                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1026                         {
1027                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1028                         }
1029                         else
1030                         {
1031                             return std::string("");
1032                         }
1033
1034                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
1035                         {
1036                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
1037                         }
1038                     }
1039                 }
1040                 return std::string("");
1041             }
1042
1043             /**
1044              * Get T&C status
1045              * Indicates T&C is already agreed or not.
1046              *
1047              * @return T&C Status
1048              *
1049              * @see TC_STATUS
1050              */
1051             TC_STATUS getTCStatus()
1052             {
1053                 OCRepresentation rep;
1054                 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
1055                 {
1056                     rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1057                 }
1058                 else
1059                 {
1060                     return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
1061                 }
1062
1063                 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
1064                 {
1065                     return static_cast<TC_STATUS>
1066                             (rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
1067                 }
1068
1069                 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
1070             }
1071
1072             /**
1073              * Get T&C Header
1074              * T&C Header Information in json format
1075              *
1076              * @return T&C Header
1077              */
1078             std::string getTCHeader()
1079             {
1080                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1081                 for(auto child = children.begin(); child != children.end(); ++child)
1082                 {
1083                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1084                     {
1085                         OCRepresentation rep;
1086                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1087                         {
1088                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1089                         }
1090                         else
1091                         {
1092                             return std::string("");
1093                         }
1094
1095                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_HEADER))
1096                         {
1097                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_HEADER);
1098                         }
1099                     }
1100                 }
1101                 return std::string("");
1102             }
1103
1104             /**
1105              * Get T&C Version
1106              *
1107              * @return T&C Version
1108              */
1109             std::string getTCVersion()
1110             {
1111                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1112                 for(auto child = children.begin(); child != children.end(); ++child)
1113                 {
1114                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1115                     {
1116                         OCRepresentation rep;
1117                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1118                         {
1119                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1120                         }
1121                         else
1122                         {
1123                             return std::string("");
1124                         }
1125
1126                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_VERSION))
1127                         {
1128                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_VERSION);
1129                         }
1130                     }
1131                 }
1132                 return std::string("");
1133             }
1134
1135             /**
1136              * Get PnP Pin
1137              *
1138              * @return PnP Pin
1139              */
1140             std::string getPnpPin() const
1141             {
1142                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1143                 for(auto child = children.begin(); child != children.end(); ++child)
1144                 {
1145                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1146                     {
1147                         OCRepresentation rep;
1148                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1149                         {
1150                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1151                         }
1152                         else
1153                         {
1154                             return std::string("");
1155                         }
1156
1157                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_PNP_PIN))
1158                         {
1159                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PNP_PIN);
1160                         }
1161                     }
1162                 }
1163                 return std::string("");
1164             }
1165
1166             /**
1167              * Get a network connection state property of Enrollee.
1168              *
1169              * @return a network connection state property of Enrollee.
1170              */
1171             NETCONNECTION_STATE getNetConnectionState() const
1172             {
1173                 OCRepresentation rep;
1174                 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
1175                 {
1176                     rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1177                 }
1178                 else
1179                 {
1180                     return NETCONNECTION_STATE::NET_STATE_INIT;
1181                 }
1182
1183                 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
1184                 {
1185                     return static_cast<NETCONNECTION_STATE>
1186                                     (rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
1187                 }
1188
1189                 return NETCONNECTION_STATE::NET_STATE_INIT;
1190             }
1191
1192             /**
1193              * Get a BSSID of Enroller
1194              *
1195              * @return a BSSID of enroller
1196              */
1197             std::string getBSSID() const
1198             {
1199                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1200                 for(auto child = children.begin(); child != children.end(); ++child)
1201                 {
1202                     if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
1203                     {
1204                         OCRepresentation rep;
1205                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1206                         {
1207                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1208                         }
1209                         else
1210                         {
1211                             return std::string("");
1212                         }
1213
1214                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
1215                         {
1216                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
1217                         }
1218                     }
1219                 }
1220                 return {};
1221             }
1222
1223             /**
1224              * Get UTC date time
1225              *
1226              * @return UTC date time
1227              */
1228             std::string getUTCDatetime() const
1229             {
1230                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1231                 for(auto child = children.begin(); child != children.end(); ++child)
1232                 {
1233                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1234                     {
1235                         OCRepresentation rep;
1236                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1237                         {
1238                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1239                         }
1240                         else
1241                         {
1242                             return std::string("");
1243                         }
1244
1245                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
1246                         {
1247                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
1248                         }
1249                     }
1250                 }
1251                 return {};
1252             }
1253
1254             /**
1255              * Get regional date time
1256              *
1257              * @return date time
1258              */
1259             std::string getRegionalDatetime() const
1260             {
1261                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1262                 for(auto child = children.begin(); child != children.end(); ++child)
1263                 {
1264                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1265                     {
1266                         OCRepresentation rep;
1267                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1268                         {
1269                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1270                         }
1271                         else
1272                         {
1273                             return std::string("");
1274                         }
1275
1276                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
1277                         {
1278                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
1279                         }
1280                     }
1281                 }
1282                 return {};
1283             }
1284
1285             /**
1286              * Get Samsung Easy Setup Protocol Version.
1287              *
1288              * Mediator can use this API to differentiate between Easy Setup Protcol supported by
1289              * Samsung Enrollee Devices.
1290              *
1291              * Example: Version Value for Tizen4.0: [\932.0\94]
1292              *
1293              * @return Easy Setup Protocol Version String.
1294              */
1295             std::string getESProtocolVersion() const
1296             {
1297                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1298                 for(auto child = children.begin(); child != children.end(); ++child)
1299                 {
1300                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1301                     {
1302                         OCRepresentation rep;
1303                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1304                         {
1305                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1306                         }
1307                         else
1308                         {
1309                             return std::string("");
1310                         }
1311
1312                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION))
1313                         {
1314                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION);
1315                         }
1316                     }
1317                 }
1318                 return std::string("");
1319             }
1320
1321             /**
1322              * Gets the ISO country code of the device
1323              * (ISO 3166-1 Alpha-2)
1324              *
1325              * @return the ISO Country code of the device
1326              */
1327             std::string getCountry() const
1328             {
1329                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1330                 for(auto child = children.begin(); child != children.end(); ++child)
1331                 {
1332                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1333                     {
1334                         OCRepresentation rep;
1335                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1336                         {
1337                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1338                         }
1339                         else
1340                         {
1341                             return std::string("");
1342                         }
1343
1344                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY))
1345                         {
1346                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY);
1347                         }
1348                     }
1349                 }
1350                 return std::string("");
1351             }
1352
1353             /**
1354              * Gets the HubId of the device
1355              *
1356              * @return hubId of the device
1357              */
1358             std::string getHubId() const
1359             {
1360                 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1361                 for(auto child = children.begin(); child != children.end(); ++child)
1362                 {
1363                     if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1364                     {
1365                         OCRepresentation rep;
1366                         if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1367                         {
1368                             rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1369                         }
1370                         else
1371                         {
1372                             return std::string("");
1373                         }
1374
1375                         if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_HUB_ID))
1376                         {
1377                             return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_HUB_ID);
1378                         }
1379                     }
1380                 }
1381                 return std::string("");
1382             }
1383
1384         };
1385     }
1386 }
1387
1388 #endif //ESSC_COMMON_RICH_H_