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"
67 #define INVALID_DISCOVERY_CHANNEL -1
71 NET_STATE_INIT = -1, /**< Init state **/
72 NET_STATE_WIRED_CONNECTED = 0, /**< Wired connected **/
73 NET_STATE_WIRELESS_CONNECTED, /**< Wireless connected **/
74 NET_STATE_NOT_CONNECTED /**< Not connected, at all **/
75 } NETCONNECTION_STATE;
79 TC_STATUS_NOT_SUPPORTED = 0,
80 TC_STATUS_ALREADY_AGREED,
81 TC_STATUS_NEED_TO_AGREE,
82 TC_STATUS_DOWNLOADING_TC,
83 TC_STATUS_SUCCESS_TO_DOWNLOAD_TC,
84 TC_STATUS_FAIL_TO_DOWNLOAD_TC,
85 TC_STATUS_DISAGREED_WITH_TC,
86 TC_STATUS_GEO_BLOCKED,
87 TC_STATUS_TIMEOUT_TO_AGREE
90 typedef struct SCCandidateAPInfo
93 std::string passphrase;
99 * @brief Properties of provisioning resource. It includes a provisioning status and last
102 class SCEnrolleeStatus : public EnrolleeStatus
105 SCEnrolleeStatus(const EnrolleeStatus&& parent) : EnrolleeStatus(parent)
110 * Get a network connection state property of Enrollee.
112 * @return a network connection state property of Enrollee.
114 NETCONNECTION_STATE getNetConnectionState() const
116 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
118 return static_cast<NETCONNECTION_STATE>
119 (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
121 return NETCONNECTION_STATE::NET_STATE_INIT;
131 TC_STATUS getTCStatus()
133 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
135 return static_cast<TC_STATUS>
136 (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
139 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
144 * @brief Data class stored for Device property provisioning which includes a WiFi
145 * and device configuration provisioning
147 class SCDeviceProp : public DeviceProp
152 * Set DevConf resource properties to be delivered to Enrollee
154 * @param language IETF language tag using ISO 639X
155 * @param country ISO Country Code (ISO 3166-1 Alpha-2)
156 * @param location location information
158 void setDevConfProp(string language, string country, string location)
160 m_rep.setValue(SC_RSRVD_ES_VENDOR_LANGUAGE, language);
161 m_rep.setValue(SC_RSRVD_ES_VENDOR_COUNTRY, country);
162 m_rep.setValue(SC_RSRVD_ES_VENDOR_GPSLOCATION, location);
166 * Get a language to be set. A language is expressed in IETF language tag
169 * @return a language to be set
171 std::string getLanguage() const
173 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE))
175 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_LANGUAGE);
177 return std::string("");
181 * Get a country to be set. A country is expressed in ISO Country Code
182 * (ISO 3166-1 Alpha-2)
184 * @return a country to be set
186 std::string getCountry() const
188 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY))
190 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY);
192 return std::string("");
196 * Get a location to be set. A location is GPS information
198 * @return a country to be set
200 std::string getLocation() const
202 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION))
204 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_GPSLOCATION);
206 return std::string("");
210 * Set discoveryChannel properties to be delivered to Enrollee
212 * @param discoveryChannel Channel of the Enroller for fast discover
214 void setDiscoveryChannel(int discoveryChannel)
216 m_rep.setValue(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL, discoveryChannel);
220 * Get an channel of Enroller
222 * @return an channel of enroller
224 int getDiscoveryChannel()
226 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL))
228 return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL);
230 return INVALID_DISCOVERY_CHANNEL;
234 * Set samsung-specific location property to be delivered to Enrollee
236 * @param locations a set of location information
238 void setSCLocation(const std::vector<std::string> &locations)
240 m_rep.setValue(SC_RSRVD_ES_VENDOR_LOCATION, locations);
244 * Set samsung account property to be delivered to Enrollee (for TV)
246 * @param account a samsung account ID information (for TV)
248 void setSCAccount(const std::string &account)
250 m_rep.setValue(SC_RSRVD_ES_VENDOR_ACCOUNT, account);
254 * Set UTC date time property to be delivered to Enrollee.
255 * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
257 * @param datetime UTC date time
259 void setUTCDatetime(const std::string &datetime)
261 m_rep.setValue(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME, datetime);
265 * Get UTC date time property
267 * @return UTC date time
269 std::string getUTCDatetime()
271 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
273 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
279 * Set regional date time property to be delivered to Enrollee.
280 * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
282 * @param datetime Regional date time
284 void setRegionalDatetime(const std::string &datetime)
286 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME, datetime);
290 * Get regional date time property
294 std::string getRegionalDatetime()
296 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
298 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
304 * Set Mobile device information used for 'register TV'
305 * The format is in json. The key indicates the meaning of value and the value is a
306 * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
307 * bm(BT MAC), dn(device name), dt(device type), it(icon type).
309 * @param regMobileDev register mobile device
311 void setRegisterMobileDevice(const std::string ®MobileDev)
313 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV, regMobileDev);
317 * Get Mobile device information used for 'register TV'
319 * @return register mobile device
321 std::string getRegisterMobileDevice()
323 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV))
325 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV);
331 * Set a BSSID of Enroller
333 * @param a BSSID of enroller
335 void setBSSID(const std::string &bssid)
337 m_rep.setValue(SC_RSRVD_ES_VENDOR_BSSID, bssid);
341 * Get a BSSID of Enroller
343 * @return a BSSID of enroller
345 std::string getBSSID()
347 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
349 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
355 * Set SSO list information
359 void setSSOList(const std::string &ssoList)
361 m_rep.setValue(SC_RSRVD_ES_VENDOR_SSO_LIST, ssoList);
365 * Get SSO List information which is registered in device
369 std::string getSSOList()
371 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
373 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
379 * Set Candidate AP information which is stored.
381 * @param clientID - Client service ID
383 void setCandidateAPList(SCCandidateAPInfo *candidateInfo,int numCandidateAP)
385 std::vector<OC::OCRepresentation> candidateAPList;
386 for (int i=0;i<numCandidateAP;i++)
388 OCRepresentation candidateListInfo;
389 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_BSSID, candidateInfo[i].bssid);
390 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL, candidateInfo[i].channel);
391 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_PASSPHRASE, candidateInfo[i].passphrase);
392 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_SSID, candidateInfo[i].ssid);
393 candidateAPList.push_back(candidateListInfo);
395 m_rep.setValue(SC_RSRVD_ES_VENDOR_CANDIDATEAPS, candidateAPList);
399 * Get Candidate AP information which is registered in device.
401 * @return SCCandidateAPInfo list.
403 std::vector<SCCandidateAPInfo> getCandidateAPList()
405 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
407 std::vector<OC::OCRepresentation> candidateInfo=
408 m_rep.getValue<std::vector<OC::OCRepresentation>>(SC_RSRVD_ES_VENDOR_CANDIDATEAPS);
409 std::vector<SCCandidateAPInfo> postcandidateInfo;
410 for(std::vector<OC::OCRepresentation>::iterator it = candidateInfo.begin();
411 it != candidateInfo.end(); ++it)
413 OC::OCRepresentation rep = *it;
414 SCCandidateAPInfo candidateInfotemp;
415 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSID))
417 candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSID);
419 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_PASSPHRASE))
421 candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PASSPHRASE);
423 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
425 candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
428 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
430 candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
432 postcandidateInfo.push_back(candidateInfotemp);
434 return postcandidateInfo;
440 class SCCloudProp : public CloudProp
444 * Set samsung-specific client service ID property to be delivered to Enrollee
446 * @param clientID - Client service ID
448 void setClientID(const std::string &clientID)
450 m_rep.setValue(SC_RSRVD_ES_VENDOR_CLIENTID, clientID);
454 * Get samsung-specific client service ID property.
456 * @return Client service ID.
458 std::string getClientID()
460 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CLIENTID))
462 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CLIENTID);
468 * Set samsung-specific additional AuthCode property to be delivered to Enrollee (for TV/AV sign up VD SSO)
470 * @param additionalAuthcode - additional AuthCode (for TV/AV sign up VD SSO)
472 void setAdditionalAuthCode(const std::string &additionalAuthcode)
474 m_rep.setValue(SC_RSRVD_ES_VENDOR_ADDITIONAL_AUTH_CODE, additionalAuthcode);
478 * Set samsung-specific refresh token property to be delivered to Enrollee
480 * @param refreshtoken - Refresh token.
482 void setRefreshToken(const std::string &refreshtoken)
484 m_rep.setValue(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN, refreshtoken);
488 * Get samsung-specific refresh token property.
490 * @return refreshtoken - Refresh token.
492 std::string getRefreshToken()
494 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN))
496 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN);
502 * Set samsung-specific user ID property to be delivered to Enrollee
504 * @param uid - user ID.
506 void setUserID(const std::string &uid)
508 m_rep.setValue(SC_RSRVD_ES_VENDOR_USERID, uid);
512 * Get samsung-specific user ID property
514 * @return uid - user ID.
516 std::string getUserID()
518 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_USERID))
520 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_USERID);
527 * Indicates T&C result by mobile user in json format.
529 * @param uid - user ID.
531 void setTCResult(const std::string &result)
533 m_rep.setValue(SC_RSRVD_ES_VENDOR_TC_RESULT, result);
539 * @return uid - user ID.
541 std::string getTCResult()
543 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_RESULT))
545 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_RESULT);
552 * @breif This provide a set of getter APIs from received response for getConfiguration().
553 * Received information includes a device name, WiFi supported mode, and frequency.
554 * Additionally, you can know if Enrollee can be access to cloud server with this
557 class SCEnrolleeConf : public EnrolleeConf
560 SCEnrolleeConf(const EnrolleeConf&& parent) : EnrolleeConf(parent)
565 * Get a model number of Enrollee.
567 * @return a model number of Enrollee
569 std::string getModelNumber() const
571 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
572 for(auto child = children.begin(); child != children.end(); ++child)
574 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
576 OCRepresentation rep;
577 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
579 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
583 return std::string("");
586 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER))
588 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_MODEL_NUMBER);
592 return std::string("");
596 * Get a device type of Enrollee.
597 * It is Device's human-friendly name like device model name.
599 * @return a device type of Enrollee
601 std::string getDeviceType() const
603 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
604 for(auto child = children.begin(); child != children.end(); ++child)
606 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
608 OCRepresentation rep;
609 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
611 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
615 return std::string("");
618 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_TYPE))
620 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_TYPE);
624 return std::string("");
628 * Get a device sub-type of Enrollee.
629 * It is Device's human-friendly name like device model name.
631 * @return a device sub-type of Enrollee
633 std::string getDeviceSubType() const
635 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
636 for(auto child = children.begin(); child != children.end(); ++child)
638 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
640 OCRepresentation rep;
641 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
643 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
647 return std::string("");
650 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE))
652 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE);
656 return std::string("");
660 * Get Set device information used for 'register TV'
661 * The format is in json. The key indicates the meaning of value and the value is a
662 * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
663 * bm(BT MAC), rt(Remote Type)
665 * @return Register Set Device
667 std::string getRegisterSetDevice() const
669 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
670 for(auto child = children.begin(); child != children.end(); ++child)
672 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
674 OCRepresentation rep;
675 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
677 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
681 return std::string("");
684 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV))
686 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV);
690 return std::string("");
694 * Get Candidate AP information which is registered in device.
696 * @return SCCandidateAPInfo list.
698 std::vector<SCCandidateAPInfo> getCandidateAPList() const
700 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
701 for(auto child = children.begin(); child != children.end(); ++child)
703 if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
705 OCRepresentation rep;
706 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
708 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
711 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
713 std::vector<OC::OCRepresentation> candidateInfo=rep.getValue<std::vector<OC::OCRepresentation>>(SC_RSRVD_ES_VENDOR_CANDIDATEAPS);
714 std::vector<SCCandidateAPInfo> postcandidateInfo;
715 for(std::vector<OC::OCRepresentation>::iterator it = candidateInfo.begin();
716 it != candidateInfo.end(); ++it)
718 OC::OCRepresentation rep = *it;
719 SCCandidateAPInfo candidateInfotemp;
720 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSID))
722 candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSID);
724 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_PASSPHRASE))
726 candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PASSPHRASE);
728 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
730 candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
733 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
735 candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
737 postcandidateInfo.push_back(candidateInfotemp);
739 return postcandidateInfo;
747 * Get network provisioning information for the device.
748 * Mediator can use this information to enquire & validate registration status with corresponding Network Vendor.
749 * The format is in JSON. The key indicates the meaning of value and the value is a
750 * corresponding information. Supported keys include: IMEI (IMEI Number), IMSI (IMSI Number),
751 * MCC_MNC(MCC & MNC Number), SN(Serial Number)
753 * @return Network Provisioning Information String.
755 std::string getNetworkProvisioningInfo() const
757 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
758 for(auto child = children.begin(); child != children.end(); ++child)
760 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
762 OCRepresentation rep;
763 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
765 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
769 return std::string("");
772 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO))
774 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO);
778 return std::string("");
782 * Get SSO List information for the device.
783 * The format is in JSON. The key indicates the meaning of value and the value is a
784 * corresponding information. Supported keys include: Available Count , Registered Count,
787 * @return SSo List Information String.
789 std::string getSSOList() const
791 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
792 for(auto child = children.begin(); child != children.end(); ++child)
794 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
796 OCRepresentation rep;
797 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
799 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
803 return std::string("");
806 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
808 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
812 return std::string("");
817 * Indicates T&C is already agreed or not.
823 TC_STATUS getTCStatus()
825 OCRepresentation rep;
826 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
828 rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
832 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
835 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
837 return static_cast<TC_STATUS>
838 (rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
841 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
846 * T&C Header Information in json format
850 std::string getTCHeader()
852 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
853 for(auto child = children.begin(); child != children.end(); ++child)
855 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
857 OCRepresentation rep;
858 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
860 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
864 return std::string("");
867 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_HEADER))
869 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_HEADER);
873 return std::string("");
879 * @return T&C Version
881 std::string getTCVersion()
883 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
884 for(auto child = children.begin(); child != children.end(); ++child)
886 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
888 OCRepresentation rep;
889 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
891 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
895 return std::string("");
898 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_VERSION))
900 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_VERSION);
904 return std::string("");
912 std::string getPnpPin() const
914 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
915 for(auto child = children.begin(); child != children.end(); ++child)
917 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
919 OCRepresentation rep;
920 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
922 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
926 return std::string("");
929 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_PNP_PIN))
931 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PNP_PIN);
935 return std::string("");
939 * Get a network connection state property of Enrollee.
941 * @return a network connection state property of Enrollee.
943 NETCONNECTION_STATE getNetConnectionState() const
945 OCRepresentation rep;
946 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
948 rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
952 return NETCONNECTION_STATE::NET_STATE_INIT;
955 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
957 return static_cast<NETCONNECTION_STATE>
958 (rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
961 return NETCONNECTION_STATE::NET_STATE_INIT;
965 * Get a BSSID of Enroller
967 * @return a BSSID of enroller
969 std::string getBSSID() const
971 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
972 for(auto child = children.begin(); child != children.end(); ++child)
974 if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
976 OCRepresentation rep;
977 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
979 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
983 return std::string("");
986 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
988 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
998 * @return UTC date time
1000 std::string getUTCDatetime() const
1002 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1003 for(auto child = children.begin(); child != children.end(); ++child)
1005 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1007 OCRepresentation rep;
1008 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1010 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1014 return std::string("");
1017 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
1019 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
1027 * Get regional date time
1031 std::string getRegionalDatetime() const
1033 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1034 for(auto child = children.begin(); child != children.end(); ++child)
1036 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1038 OCRepresentation rep;
1039 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1041 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1045 return std::string("");
1048 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
1050 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
1058 * Get Samsung Easy Setup Protocol Version.
1060 * Mediator can use this API to differentiate between Easy Setup Protcol supported by
1061 * Samsung Enrollee Devices.
1063 * Example: Version Value for Tizen4.0: [
\932.0
\94]
1065 * @return Easy Setup Protocol Version String.
1067 std::string getESProtocolVersion() const
1069 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1070 for(auto child = children.begin(); child != children.end(); ++child)
1072 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1074 OCRepresentation rep;
1075 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1077 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1081 return std::string("");
1084 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION))
1086 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION);
1090 return std::string("");
1097 #endif //ESSC_COMMON_RICH_H_