1 //******************************************************************
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef ESSC_COMMON_RICH_H_
22 #define ESSC_COMMON_RICH_H_
24 #include "ESRichCommon.h"
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 #define SC_RSRVD_ES_VENDOR_CANDIDATEAPS "x.com.samsung.candidateaps"
58 #define SC_RSRVD_ES_VENDOR_SSID "x.com.samsung.ssid"
59 #define SC_RSRVD_ES_VENDOR_PASSPHRASE "x.com.samsung.passphrase"
60 #define SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL "x.com.samsung.channel"
62 #define MAXLEN_STRING 1000
70 #define INVALID_DISCOVERY_CHANNEL -1
74 NET_STATE_INIT = -1, /**< Init state **/
75 NET_STATE_WIRED_CONNECTED = 0, /**< Wired connected **/
76 NET_STATE_WIRELESS_CONNECTED, /**< Wireless connected **/
77 NET_STATE_NOT_CONNECTED /**< Not connected, at all **/
78 } NETCONNECTION_STATE;
82 TC_STATUS_NOT_SUPPORTED = 0,
83 TC_STATUS_ALREADY_AGREED,
84 TC_STATUS_NEED_TO_AGREE,
85 TC_STATUS_DOWNLOADING_TC,
86 TC_STATUS_SUCCESS_TO_DOWNLOAD_TC,
87 TC_STATUS_FAIL_TO_DOWNLOAD_TC,
88 TC_STATUS_DISAGREED_WITH_TC,
89 TC_STATUS_GEO_BLOCKED,
90 TC_STATUS_TIMEOUT_TO_AGREE
93 typedef struct SCCandidateAPInfo
96 std::string passphrase;
102 * @brief Properties of provisioning resource. It includes a provisioning status and last
105 class SCEnrolleeStatus : public EnrolleeStatus
108 SCEnrolleeStatus(const EnrolleeStatus&& parent) : EnrolleeStatus(parent)
113 * Get a network connection state property of Enrollee.
115 * @return a network connection state property of Enrollee.
117 NETCONNECTION_STATE getNetConnectionState() const
119 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
121 return static_cast<NETCONNECTION_STATE>
122 (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
124 return NETCONNECTION_STATE::NET_STATE_INIT;
134 TC_STATUS getTCStatus()
136 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
138 return static_cast<TC_STATUS>
139 (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
142 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
147 * @brief Data class stored for Device property provisioning which includes a WiFi
148 * and device configuration provisioning
150 class SCDeviceProp : public DeviceProp
155 * Set DevConf resource properties to be delivered to Enrollee
157 * @param language IETF language tag using ISO 639X
158 * @param country ISO Country Code (ISO 3166-1 Alpha-2)
159 * @param location location information
161 void setDevConfProp(string language, string country, string location)
163 m_rep.setValue(SC_RSRVD_ES_VENDOR_LANGUAGE, language);
164 m_rep.setValue(SC_RSRVD_ES_VENDOR_COUNTRY, country);
165 m_rep.setValue(SC_RSRVD_ES_VENDOR_GPSLOCATION, location);
169 * Get a language to be set. A language is expressed in IETF language tag
172 * @return a language to be set
174 std::string getLanguage() const
176 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE))
178 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_LANGUAGE);
180 return std::string("");
184 * Get a country to be set. A country is expressed in ISO Country Code
185 * (ISO 3166-1 Alpha-2)
187 * @return a country to be set
189 std::string getCountry() const
191 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY))
193 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY);
195 return std::string("");
199 * Get a location to be set. A location is GPS information
201 * @return a country to be set
203 std::string getLocation() const
205 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION))
207 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_GPSLOCATION);
209 return std::string("");
213 * Set discoveryChannel properties to be delivered to Enrollee
215 * @param discoveryChannel Channel of the Enroller for fast discover
217 void setDiscoveryChannel(int discoveryChannel)
219 m_rep.setValue(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL, discoveryChannel);
223 * Get an channel of Enroller
225 * @return an channel of enroller
227 int getDiscoveryChannel()
229 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL))
231 return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL);
233 return INVALID_DISCOVERY_CHANNEL;
237 * Set samsung-specific location property to be delivered to Enrollee
239 * @param locations a set of location information
241 void setSCLocation(const std::vector<std::string> &locations)
243 m_rep.setValue(SC_RSRVD_ES_VENDOR_LOCATION, locations);
247 * Set samsung account property to be delivered to Enrollee (for TV)
249 * @param account a samsung account ID information (for TV)
251 void setSCAccount(const std::string &account)
253 m_rep.setValue(SC_RSRVD_ES_VENDOR_ACCOUNT, account);
257 * Set UTC date time property to be delivered to Enrollee.
258 * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
260 * @param datetime UTC date time
262 void setUTCDatetime(const std::string &datetime)
264 m_rep.setValue(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME, datetime);
268 * Get UTC date time property
270 * @return UTC date time
272 std::string getUTCDatetime()
274 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
276 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
282 * Set regional date time property to be delivered to Enrollee.
283 * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
285 * @param datetime Regional date time
287 void setRegionalDatetime(const std::string &datetime)
289 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME, datetime);
293 * Get regional date time property
297 std::string getRegionalDatetime()
299 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
301 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
307 * Set Mobile device information used for 'register TV'
308 * The format is in json. The key indicates the meaning of value and the value is a
309 * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
310 * bm(BT MAC), dn(device name), dt(device type), it(icon type).
312 * @param regMobileDev register mobile device
314 void setRegisterMobileDevice(const std::string ®MobileDev)
316 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV, regMobileDev);
320 * Get Mobile device information used for 'register TV'
322 * @return register mobile device
324 std::string getRegisterMobileDevice()
326 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV))
328 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV);
334 * Set a BSSID of Enroller
336 * @param a BSSID of enroller
338 void setBSSID(const std::string &bssid)
340 m_rep.setValue(SC_RSRVD_ES_VENDOR_BSSID, bssid);
344 * Get a BSSID of Enroller
346 * @return a BSSID of enroller
348 std::string getBSSID()
350 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
352 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
358 * Set SSO list information
362 void setSSOList(const std::string &ssoList)
364 m_rep.setValue(SC_RSRVD_ES_VENDOR_SSO_LIST, ssoList);
368 * Get SSO List information which is registered in device
372 std::string getSSOList()
374 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
376 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
382 * Set Candidate AP information which is stored.
384 * @param clientID - Client service ID
386 void setCandidateAPList(SCCandidateAPInfo *candidateInfo,int numCandidateAP)
388 std::vector<OC::OCRepresentation> candidateAPList;
389 for (int i=0;i<numCandidateAP;i++)
391 OCRepresentation candidateListInfo;
392 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_BSSID, candidateInfo[i].bssid);
393 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL, candidateInfo[i].channel);
394 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_PASSPHRASE, candidateInfo[i].passphrase);
395 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_SSID, candidateInfo[i].ssid);
396 candidateAPList.push_back(candidateListInfo);
398 m_rep.setValue(SC_RSRVD_ES_VENDOR_CANDIDATEAPS, candidateAPList);
402 * Get Candidate AP information which is registered in device.
404 * @return SCCandidateAPInfo list.
406 std::vector<SCCandidateAPInfo> getCandidateAPList()
408 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
410 std::vector<OC::OCRepresentation> candidateInfo=
411 m_rep.getValue<std::vector<OC::OCRepresentation>>(SC_RSRVD_ES_VENDOR_CANDIDATEAPS);
412 std::vector<SCCandidateAPInfo> postcandidateInfo;
413 for(std::vector<OC::OCRepresentation>::iterator it = candidateInfo.begin();
414 it != candidateInfo.end(); ++it)
416 OC::OCRepresentation rep = *it;
417 SCCandidateAPInfo candidateInfotemp;
418 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSID))
420 candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSID);
422 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_PASSPHRASE))
424 candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PASSPHRASE);
426 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
428 candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
431 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
433 candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
435 postcandidateInfo.push_back(candidateInfotemp);
437 return postcandidateInfo;
443 class SCCloudProp : public CloudProp
447 * Set samsung-specific client service ID property to be delivered to Enrollee
449 * @param clientID - Client service ID
451 void setClientID(const std::string &clientID)
453 m_rep.setValue(SC_RSRVD_ES_VENDOR_CLIENTID, clientID);
457 * Get samsung-specific client service ID property.
459 * @return Client service ID.
461 std::string getClientID()
463 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CLIENTID))
465 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CLIENTID);
471 * Set samsung-specific additional AuthCode property to be delivered to Enrollee (for TV/AV sign up VD SSO)
473 * @param additionalAuthcode - additional AuthCode (for TV/AV sign up VD SSO)
475 void setAdditionalAuthCode(const std::string &additionalAuthcode)
477 m_rep.setValue(SC_RSRVD_ES_VENDOR_ADDITIONAL_AUTH_CODE, additionalAuthcode);
481 * Set samsung-specific refresh token property to be delivered to Enrollee
483 * @param refreshtoken - Refresh token.
485 void setRefreshToken(const std::string &refreshtoken)
487 m_rep.setValue(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN, refreshtoken);
491 * Get samsung-specific refresh token property.
493 * @return refreshtoken - Refresh token.
495 std::string getRefreshToken()
497 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN))
499 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN);
505 * Set samsung-specific user ID property to be delivered to Enrollee
507 * @param uid - user ID.
509 void setUserID(const std::string &uid)
511 m_rep.setValue(SC_RSRVD_ES_VENDOR_USERID, uid);
515 * Get samsung-specific user ID property
517 * @return uid - user ID.
519 std::string getUserID()
521 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_USERID))
523 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_USERID);
530 * Indicates T&C result by mobile user in json format.
532 * @param uid - user ID.
534 void setTCResult(const std::string &result)
536 m_rep.setValue(SC_RSRVD_ES_VENDOR_TC_RESULT, result);
542 * @return uid - user ID.
544 std::string getTCResult()
546 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_RESULT))
548 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_RESULT);
555 * @breif This provide a set of getter APIs from received response for getConfiguration().
556 * Received information includes a device name, WiFi supported mode, and frequency.
557 * Additionally, you can know if Enrollee can be access to cloud server with this
560 class SCEnrolleeConf : public EnrolleeConf
563 SCEnrolleeConf(const EnrolleeConf&& parent) : EnrolleeConf(parent)
568 * Get a model number of Enrollee.
570 * @return a model number of Enrollee
572 std::string getModelNumber() const
574 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
575 for(auto child = children.begin(); child != children.end(); ++child)
577 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
579 OCRepresentation rep;
580 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
582 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
586 return std::string("");
589 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER))
591 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_MODEL_NUMBER);
595 return std::string("");
599 * Get a device type of Enrollee.
600 * It is Device's human-friendly name like device model name.
602 * @return a device type of Enrollee
604 std::string getDeviceType() const
606 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
607 for(auto child = children.begin(); child != children.end(); ++child)
609 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
611 OCRepresentation rep;
612 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
614 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
618 return std::string("");
621 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_TYPE))
623 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_TYPE);
627 return std::string("");
631 * Get a device sub-type of Enrollee.
632 * It is Device's human-friendly name like device model name.
634 * @return a device sub-type of Enrollee
636 std::string getDeviceSubType() const
638 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
639 for(auto child = children.begin(); child != children.end(); ++child)
641 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
643 OCRepresentation rep;
644 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
646 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
650 return std::string("");
653 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE))
655 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE);
659 return std::string("");
663 * Get Set device information used for 'register TV'
664 * The format is in json. The key indicates the meaning of value and the value is a
665 * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
666 * bm(BT MAC), rt(Remote Type)
668 * @return Register Set Device
670 std::string getRegisterSetDevice() const
672 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
673 for(auto child = children.begin(); child != children.end(); ++child)
675 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
677 OCRepresentation rep;
678 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
680 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
684 return std::string("");
687 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV))
689 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV);
693 return std::string("");
697 * Get Candidate AP information which is registered in device.
699 * @return SCCandidateAPInfo list.
701 std::vector<SCCandidateAPInfo> getCandidateAPList() const
703 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
704 for(auto child = children.begin(); child != children.end(); ++child)
706 if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
708 OCRepresentation rep;
709 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
711 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
714 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
716 std::vector<OC::OCRepresentation> candidateInfo=rep.getValue<std::vector<OC::OCRepresentation>>(SC_RSRVD_ES_VENDOR_CANDIDATEAPS);
717 std::vector<SCCandidateAPInfo> postcandidateInfo;
718 for(std::vector<OC::OCRepresentation>::iterator it = candidateInfo.begin();
719 it != candidateInfo.end(); ++it)
721 OC::OCRepresentation rep = *it;
722 SCCandidateAPInfo candidateInfotemp;
723 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSID))
725 candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSID);
727 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_PASSPHRASE))
729 candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PASSPHRASE);
731 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
733 candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
736 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
738 candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
740 postcandidateInfo.push_back(candidateInfotemp);
742 return postcandidateInfo;
749 * Get network provisioning information for the device.
750 * Mediator can use this information to enquire & validate registration status with corresponding Network Vendor.
751 * The format is in JSON. The key indicates the meaning of value and the value is a
752 * corresponding information. Supported keys include: IMEI (IMEI Number), IMSI (IMSI Number),
753 * MCC_MNC(MCC & MNC Number), SN(Serial Number)
755 * @return Network Provisioning Information String.
757 std::string getNetworkProvisioningInfo() const
759 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
760 for(auto child = children.begin(); child != children.end(); ++child)
762 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
764 OCRepresentation rep;
765 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
767 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
771 return std::string("");
774 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO))
776 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO);
780 return std::string("");
784 * Get SSO List information for the device.
785 * The format is in JSON. The key indicates the meaning of value and the value is a
786 * corresponding information. Supported keys include: Available Count , Registered Count,
789 * @return SSo List Information String.
791 std::string getSSOList() const
793 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
794 for(auto child = children.begin(); child != children.end(); ++child)
796 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
798 OCRepresentation rep;
799 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
801 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
805 return std::string("");
808 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
810 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
814 return std::string("");
819 * Indicates T&C is already agreed or not.
825 TC_STATUS getTCStatus()
827 OCRepresentation rep;
828 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
830 rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
834 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
837 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
839 return static_cast<TC_STATUS>
840 (rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
843 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
848 * T&C Header Information in json format
852 std::string getTCHeader()
854 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
855 for(auto child = children.begin(); child != children.end(); ++child)
857 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
859 OCRepresentation rep;
860 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
862 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
866 return std::string("");
869 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_HEADER))
871 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_HEADER);
875 return std::string("");
881 * @return T&C Version
883 std::string getTCVersion()
885 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
886 for(auto child = children.begin(); child != children.end(); ++child)
888 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
890 OCRepresentation rep;
891 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
893 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
897 return std::string("");
900 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_VERSION))
902 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_VERSION);
906 return std::string("");
914 std::string getPnpPin() const
916 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
917 for(auto child = children.begin(); child != children.end(); ++child)
919 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
921 OCRepresentation rep;
922 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
924 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
928 return std::string("");
931 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_PNP_PIN))
933 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PNP_PIN);
937 return std::string("");
941 * Get a network connection state property of Enrollee.
943 * @return a network connection state property of Enrollee.
945 NETCONNECTION_STATE getNetConnectionState() const
947 OCRepresentation rep;
948 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
950 rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
954 return NETCONNECTION_STATE::NET_STATE_INIT;
957 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
959 return static_cast<NETCONNECTION_STATE>
960 (rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
963 return NETCONNECTION_STATE::NET_STATE_INIT;
967 * Get a BSSID of Enroller
969 * @return a BSSID of enroller
971 std::string getBSSID() const
973 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
974 for(auto child = children.begin(); child != children.end(); ++child)
976 if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
978 OCRepresentation rep;
979 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
981 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
985 return std::string("");
988 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
990 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
1000 * @return UTC date time
1002 std::string getUTCDatetime() const
1004 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1005 for(auto child = children.begin(); child != children.end(); ++child)
1007 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1009 OCRepresentation rep;
1010 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1012 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1016 return std::string("");
1019 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
1021 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
1029 * Get regional date time
1033 std::string getRegionalDatetime() const
1035 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1036 for(auto child = children.begin(); child != children.end(); ++child)
1038 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1040 OCRepresentation rep;
1041 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1043 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1047 return std::string("");
1050 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
1052 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
1060 * Get Samsung Easy Setup Protocol Version.
1062 * Mediator can use this API to differentiate between Easy Setup Protcol supported by
1063 * Samsung Enrollee Devices.
1065 * Example: Version Value for Tizen4.0: [
\932.0
\94]
1067 * @return Easy Setup Protocol Version String.
1069 std::string getESProtocolVersion() const
1071 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1072 for(auto child = children.begin(); child != children.end(); ++child)
1074 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1076 OCRepresentation rep;
1077 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1079 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1083 return std::string("");
1086 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION))
1088 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION);
1092 return std::string("");
1099 #endif //ESSC_COMMON_RICH_H_