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_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"
81 #define INVALID_DISCOVERY_CHANNEL -1
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;
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
104 typedef struct SCCandidateAPInfo
107 std::string passphrase;
112 static std::vector<SCCandidateAPInfo> getCandidateAPListHelper(OCRepresentation rep)
114 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
116 std::vector<OC::OCRepresentation> candidateInfo =
117 rep.getValue<std::vector<OC::OCRepresentation>>(SC_RSRVD_ES_VENDOR_CANDIDATEAPS);
118 std::vector<SCCandidateAPInfo> postcandidateInfo;
119 for(std::vector<OC::OCRepresentation>::iterator it = candidateInfo.begin();
120 it != candidateInfo.end(); ++it)
122 OC::OCRepresentation rep = *it;
123 SCCandidateAPInfo candidateInfotemp;
124 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID))
126 candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID);
128 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE))
130 candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE);
132 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
134 candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
136 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID))
138 candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID);
140 postcandidateInfo.push_back(candidateInfotemp);
142 return postcandidateInfo;
147 static std::string getEasySetupPropHelper(OCRepresentation easySetupRep, std::string propName)
149 std::vector<OCRepresentation> children = easySetupRep.getChildren();
150 for(auto child = children.begin(); child != children.end(); ++child)
152 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
154 OCRepresentation rep;
155 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
157 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
161 return std::string("");
164 if(rep.hasAttribute(propName))
166 return rep.getValue<std::string>(propName);
170 return std::string("");
175 * @brief Properties of provisioning resource. It includes a provisioning status and last
178 class SCEnrolleeStatus : public EnrolleeStatus
181 SCEnrolleeStatus(const EnrolleeStatus&& parent) : EnrolleeStatus(parent)
186 * Get a network connection state property of Enrollee.
188 * @return a network connection state property of Enrollee.
190 NETCONNECTION_STATE getNetConnectionState() const
192 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
194 return static_cast<NETCONNECTION_STATE>
195 (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
197 return NETCONNECTION_STATE::NET_STATE_INIT;
207 TC_STATUS getTCStatus()
209 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
211 return static_cast<TC_STATUS>
212 (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
215 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
220 * @brief Data class stored for Device property provisioning which includes a WiFi
221 * and device configuration provisioning
223 class SCDeviceProp : public DeviceProp
228 * Set DevConf resource properties to be delivered to Enrollee
230 * @param language IETF language tag using ISO 639X
231 * @param country ISO Country Code (ISO 3166-1 Alpha-2)
232 * @param location location information
234 void setDevConfProp(string language, string country, string location)
236 m_rep.setValue(SC_RSRVD_ES_VENDOR_LANGUAGE, language);
237 m_rep.setValue(SC_RSRVD_ES_VENDOR_COUNTRY, country);
238 m_rep.setValue(SC_RSRVD_ES_VENDOR_GPSLOCATION, location);
240 /* [CONPRO-888] Support backward compatibility */
241 m_rep.setValue(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD, language);
242 m_rep.setValue(SC_RSRVD_ES_VENDOR_COUNTRY_OLD, country);
243 m_rep.setValue(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD, location);
247 * Get a language to be set. A language is expressed in IETF language tag
250 * @return a language to be set
252 std::string getLanguage() const
254 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE))
256 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_LANGUAGE);
258 else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD))
260 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD);
262 return std::string("");
266 * Get a country to be set. A country is expressed in ISO Country Code
267 * (ISO 3166-1 Alpha-2)
269 * @return a country to be set
271 std::string getCountry() const
273 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY))
275 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY);
277 else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY_OLD))
279 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY_OLD);
281 return std::string("");
285 * Get a location to be set. A location is GPS information
287 * @return a country to be set
289 std::string getLocation() const
291 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION))
293 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_GPSLOCATION);
295 else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD))
297 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD);
299 return std::string("");
303 * Set discoveryChannel properties to be delivered to Enrollee
305 * @param discoveryChannel Channel of the Enroller for fast discover
307 void setDiscoveryChannel(int discoveryChannel)
309 m_rep.setValue(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL, discoveryChannel);
313 * Get an channel of Enroller
315 * @return an channel of enroller
317 int getDiscoveryChannel()
319 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL))
321 return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL);
323 return INVALID_DISCOVERY_CHANNEL;
327 * Set samsung-specific location property to be delivered to Enrollee
329 * @param locations a set of location information
331 void setSCLocation(const std::vector<std::string> &locations)
333 m_rep.setValue(SC_RSRVD_ES_VENDOR_LOCATION, locations);
337 * Set samsung account property to be delivered to Enrollee (for TV)
339 * @param account a samsung account ID information (for TV)
341 void setSCAccount(const std::string &account)
343 m_rep.setValue(SC_RSRVD_ES_VENDOR_ACCOUNT, account);
347 * Set UTC date time property to be delivered to Enrollee.
348 * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
350 * @param datetime UTC date time
352 void setUTCDatetime(const std::string &datetime)
354 m_rep.setValue(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME, datetime);
358 * Get UTC date time property
360 * @return UTC date time
362 std::string getUTCDatetime()
364 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
366 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
372 * Set regional date time property to be delivered to Enrollee.
373 * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
375 * @param datetime Regional date time
377 void setRegionalDatetime(const std::string &datetime)
379 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME, datetime);
383 * Get regional date time property
387 std::string getRegionalDatetime()
389 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
391 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
397 * Set Mobile device information used for 'register TV'
398 * The format is in json. The key indicates the meaning of value and the value is a
399 * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
400 * bm(BT MAC), dn(device name), dt(device type), it(icon type).
402 * @param regMobileDev register mobile device
404 void setRegisterMobileDevice(const std::string ®MobileDev)
406 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV, regMobileDev);
410 * Get Mobile device information used for 'register TV'
412 * @return register mobile device
414 std::string getRegisterMobileDevice()
416 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV))
418 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV);
424 * Set a BSSID of Enroller
426 * @param a BSSID of enroller
428 void setBSSID(const std::string &bssid)
430 m_rep.setValue(SC_RSRVD_ES_VENDOR_BSSID, bssid);
434 * Get a BSSID of Enroller
436 * @return a BSSID of enroller
438 std::string getBSSID()
440 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
442 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
448 * Set SSO list information
452 void setSSOList(const std::string &ssoList)
454 m_rep.setValue(SC_RSRVD_ES_VENDOR_SSO_LIST, ssoList);
458 * Get SSO List information which is registered in device
462 std::string getSSOList()
464 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
466 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
472 * Set Candidate AP information which is stored.
474 * @param clientID - Client service ID
476 void setCandidateAPList(SCCandidateAPInfo *candidateInfo,int numCandidateAP)
478 std::vector<OC::OCRepresentation> candidateAPList;
479 for (int i=0;i<numCandidateAP;i++)
481 OCRepresentation candidateListInfo;
482 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID, candidateInfo[i].bssid);
483 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL, candidateInfo[i].channel);
484 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE, candidateInfo[i].passphrase);
485 candidateListInfo.setValue(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID, candidateInfo[i].ssid);
486 candidateAPList.push_back(candidateListInfo);
488 m_rep.setValue(SC_RSRVD_ES_VENDOR_CANDIDATEAPS, candidateAPList);
492 * Get Candidate AP information which is registered in device.
494 * @return SCCandidateAPInfo list.
496 std::vector<SCCandidateAPInfo> getCandidateAPList()
498 return getCandidateAPListHelper(m_rep);
502 * Set time zone for location based services when easy-setup is done
504 * @param Name of timeZone
506 void setTimeZoneId(const std::string &timeZoneId)
508 m_rep.setValue(SC_RSRVD_ES_VENDOR_TIMEZONE_ID, timeZoneId);
512 * Get the Name of TimeZone
514 * @return Name of timeZone
516 std::string getTimeZoneId()
518 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TIMEZONE_ID))
520 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TIMEZONE_ID);
526 * Sets the hidden property of wifi
527 * if the Value is true, wifi is a hidden wifi, otherwise it is not
529 * @param isHidden: value indicating whether the wifi is hidden or not
531 void setHiddenProperty(bool isHidden)
533 m_rep.setValue(SC_RSRVD_ES_VENDOR_HIDDEN, isHidden);
537 * Gets the property of the wifi whether it is hidden or not
539 * @return hidden value indicating whether the wifi is hidden or not
541 bool getHiddenProperty()
543 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_HIDDEN))
545 return m_rep.getValue<bool>(SC_RSRVD_ES_VENDOR_HIDDEN);
551 class SCCloudProp : public CloudProp
555 * Set samsung-specific client service ID property to be delivered to Enrollee
557 * @param clientID - Client service ID
559 void setClientID(const std::string &clientID)
561 m_rep.setValue(SC_RSRVD_ES_VENDOR_CLIENTID, clientID);
565 * Get samsung-specific client service ID property.
567 * @return Client service ID.
569 std::string getClientID()
571 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CLIENTID))
573 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CLIENTID);
579 * Set samsung-specific additional AuthCode property to be delivered to Enrollee (for TV/AV sign up VD SSO)
581 * @param additionalAuthcode - additional AuthCode (for TV/AV sign up VD SSO)
583 void setAdditionalAuthCode(const std::string &additionalAuthcode)
585 m_rep.setValue(SC_RSRVD_ES_VENDOR_ADDITIONAL_AUTH_CODE, additionalAuthcode);
589 * Set samsung-specific additional Api provider to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO)
591 * @param additionalApiProvider - additional Api Provider
593 void setAdditionalApiProvider(const std::string &additionalApiProvider)
595 m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_API_SERVER, additionalApiProvider);
599 * Get samsung-specific additional Api provider (for devices(TV/AV, Lux) sign up SSO)
601 * @return additionalApiProvider - additional Api Provider
603 std::string getAdditionalApiProvider()
605 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_API_SERVER))
607 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SA_API_SERVER);
613 * Set samsung-specific additional Auth provider to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO)
615 * @param additionalAuthProvider - additional Auth Provider
617 void setAdditionalAuthProvider(const std::string &additionalAuthProvider)
619 m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER, additionalAuthProvider);
623 * Get samsung-specific additional Auth provider (for devices(TV/AV, Lux) sign up SSO)
625 * @return additionalAuthProvider - additional Auth Provider
627 std::string getAdditionalAuthProvider()
629 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER))
631 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER);
637 * Set samsung-specific additional device security code to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO)
639 * @param additionalDeviceSecCode - additional DeviceSecurityCode (for devices(TV/AV, Lux) sign up VD SSO)
641 void setAdditionalDeviceSecCode(const std::string &additionalDeviceSecCode)
643 m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE, additionalDeviceSecCode);
647 * Get samsung-specific additional device security code
649 * @return additionalDeviceSecCode - additional DeviceSecurityCode
651 std::string getAdditionalDeviceSecCode()
653 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE))
655 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE);
661 * Set current deployment environment which IoT Server is operating such as "PRD" "STG"
663 * @param serverDeploymentEnv - current server Deployment Environment
665 void setServerDeploymentEnv(const std::string &serverDeploymentEnv)
667 m_rep.setValue(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT, serverDeploymentEnv);
671 * Get current server deployment environment which IoT Server is operating such as "PRD", "STG" etc
673 * @return serverDeploymentEnv - current server deployment environment
675 std::string getServerDeploymentEnv()
677 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT))
679 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT);
685 * Set Access token type.
687 * @param type - Access token type
689 void setAccessTokenType(const int type)
691 m_rep.setValue(SC_RSRVD_ES_VENDOR_IATT, type);
695 * Get Access token type.
697 * @return Access token type.
699 int getAccessTokenType(void)
701 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_IATT))
703 return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_IATT);
709 * Set samsung-specific refresh token property to be delivered to Enrollee
711 * @param refreshtoken - Refresh token.
713 void setRefreshToken(const std::string &refreshtoken)
715 m_rep.setValue(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN, refreshtoken);
719 * Get samsung-specific refresh token property.
721 * @return refreshtoken - Refresh token.
723 std::string getRefreshToken()
725 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN))
727 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN);
733 * Set samsung-specific user ID property to be delivered to Enrollee
735 * @param uid - user ID.
737 void setUserID(const std::string &uid)
739 m_rep.setValue(SC_RSRVD_ES_VENDOR_USERID, uid);
743 * Get samsung-specific user ID property
745 * @return uid - user ID.
747 std::string getUserID()
749 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_USERID))
751 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_USERID);
758 * Indicates T&C result by mobile user in json format.
760 * @param uid - user ID.
762 void setTCResult(const std::string &result)
764 m_rep.setValue(SC_RSRVD_ES_VENDOR_TC_RESULT, result);
770 * @return uid - user ID.
772 std::string getTCResult()
774 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_RESULT))
776 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_RESULT);
782 * Set samsung-specific client service ID property to be delivered to Enrollee
784 * @param clientID - Client service ID
786 void setServerId(const std::string &serverId)
788 m_rep.setValue(SC_RSRVD_ES_VENDOR_SERVER_ID, serverId);
792 * Get samsung-specific client service ID property.
794 * @return Client service ID.
796 std::string getServerId()
798 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SERVER_ID))
800 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SERVER_ID);
807 * @breif This provide a set of getter APIs from received response for getConfiguration().
808 * Received information includes a device name, WiFi supported mode, and frequency.
809 * Additionally, you can know if Enrollee can be access to cloud server with this
812 class SCEnrolleeConf : public EnrolleeConf
815 SCEnrolleeConf(const EnrolleeConf&& parent) : EnrolleeConf(parent)
820 * Get a model number of Enrollee.
822 * @return a model number of Enrollee
824 std::string getModelNumber() const
826 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
827 for(auto child = children.begin(); child != children.end(); ++child)
829 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
831 OCRepresentation rep;
832 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
834 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
838 return std::string("");
841 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER))
843 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_MODEL_NUMBER);
845 else if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD))
847 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD);
851 return std::string("");
855 * Get a device type of Enrollee.
856 * It is Device's human-friendly name like device model name.
858 * @return a device type of Enrollee
860 std::string getDeviceType() const
862 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_DEVICE_TYPE);
866 * Get a device sub-type of Enrollee.
867 * It is Device's human-friendly name like device model name.
869 * @return a device sub-type of Enrollee
871 std::string getDeviceSubType() const
873 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE);
877 * Get Set device information used for 'register TV'
878 * The format is in json. The key indicates the meaning of value and the value is a
879 * corresponding information. Supported keys include: wm(Wifi MAC), pm(P2P MAC),
880 * bm(BT MAC), rt(Remote Type)
882 * @return Register Set Device
884 std::string getRegisterSetDevice() const
886 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV);
890 * Get Candidate AP information which is registered in device.
892 * @return SCCandidateAPInfo list.
894 std::vector<SCCandidateAPInfo> getCandidateAPList() const
896 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
897 for (auto child = children.begin(); child != children.end(); ++child)
899 if (child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
901 OCRepresentation rep;
902 if (child->hasAttribute(OC_RSRVD_REPRESENTATION))
904 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
907 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
909 return getCandidateAPListHelper(rep);
917 * Get network provisioning information for the device.
918 * Mediator can use this information to enquire & validate registration status with corresponding Network Vendor.
919 * The format is in JSON. The key indicates the meaning of value and the value is a
920 * corresponding information. Supported keys include: IMEI (IMEI Number), IMSI (IMSI Number),
921 * MCC_MNC(MCC & MNC Number), SN(Serial Number)
923 * @return Network Provisioning Information String.
925 std::string getNetworkProvisioningInfo() const
927 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO);
931 * Get SSO List information for the device.
932 * The format is in JSON. The key indicates the meaning of value and the value is a
933 * corresponding information. Supported keys include: Available Count , Registered Count,
936 * @return SSo List Information String.
938 std::string getSSOList() const
940 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_SSO_LIST);
945 * Indicates T&C is already agreed or not.
951 TC_STATUS getTCStatus()
953 OCRepresentation rep;
954 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
956 rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
960 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
963 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
965 return static_cast<TC_STATUS>
966 (rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
969 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
974 * T&C Header Information in json format
978 std::string getTCHeader()
980 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_TC_HEADER);
986 * @return T&C Version
988 std::string getTCVersion()
990 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_TC_VERSION);
998 std::string getPnpPin() const
1000 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_PNP_PIN);
1004 * Get a network connection state property of Enrollee.
1006 * @return a network connection state property of Enrollee.
1008 NETCONNECTION_STATE getNetConnectionState() const
1010 OCRepresentation rep;
1011 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
1013 rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1017 return NETCONNECTION_STATE::NET_STATE_INIT;
1020 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
1022 return static_cast<NETCONNECTION_STATE>
1023 (rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
1026 return NETCONNECTION_STATE::NET_STATE_INIT;
1030 * Get a BSSID of Enroller
1032 * @return a BSSID of enroller
1034 std::string getBSSID() const
1036 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1037 for(auto child = children.begin(); child != children.end(); ++child)
1039 if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
1041 OCRepresentation rep;
1042 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1044 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1048 return std::string("");
1051 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
1053 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
1063 * @return UTC date time
1065 std::string getUTCDatetime() const
1067 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
1071 * Get regional date time
1075 std::string getRegionalDatetime() const
1077 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
1081 * Get Samsung Easy Setup Protocol Version.
1083 * Mediator can use this API to differentiate between Easy Setup Protcol supported by
1084 * Samsung Enrollee Devices.
1086 * Example: Version Value for Tizen4.0: [
\932.0
\94]
1088 * @return Easy Setup Protocol Version String.
1090 std::string getESProtocolVersion() const
1092 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION);
1096 * Gets the ISO country code of the device
1097 * (ISO 3166-1 Alpha-2)
1099 * @return the ISO Country code of the device
1101 std::string getCountry() const
1103 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_COUNTRY);
1107 * Gets the HubId of the device
1109 * @return hubId of the device
1111 std::string getHubId() const
1113 return getEasySetupPropHelper(m_EasySetupRep, SC_RSRVD_ES_VENDOR_HUB_ID);
1119 #endif //ESSC_COMMON_RICH_H_