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;
113 * @brief Properties of provisioning resource. It includes a provisioning status and last
116 class SCEnrolleeStatus : public EnrolleeStatus
119 SCEnrolleeStatus(const EnrolleeStatus&& parent) : EnrolleeStatus(parent)
124 * Get a network connection state property of Enrollee.
126 * @return a network connection state property of Enrollee.
128 NETCONNECTION_STATE getNetConnectionState() const
130 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
132 return static_cast<NETCONNECTION_STATE>
133 (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
135 return NETCONNECTION_STATE::NET_STATE_INIT;
145 TC_STATUS getTCStatus()
147 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
149 return static_cast<TC_STATUS>
150 (m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
153 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
158 * @brief Data class stored for Device property provisioning which includes a WiFi
159 * and device configuration provisioning
161 class SCDeviceProp : public DeviceProp
166 * Set DevConf resource properties to be delivered to Enrollee
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
172 void setDevConfProp(string language, string country, string location)
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);
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);
185 * Get a language to be set. A language is expressed in IETF language tag
188 * @return a language to be set
190 std::string getLanguage() const
192 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE))
194 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_LANGUAGE);
196 else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD))
198 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_LANGUAGE_OLD);
200 return std::string("");
204 * Get a country to be set. A country is expressed in ISO Country Code
205 * (ISO 3166-1 Alpha-2)
207 * @return a country to be set
209 std::string getCountry() const
211 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY))
213 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY);
215 else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY_OLD))
217 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY_OLD);
219 return std::string("");
223 * Get a location to be set. A location is GPS information
225 * @return a country to be set
227 std::string getLocation() const
229 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION))
231 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_GPSLOCATION);
233 else if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD))
235 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_GPSLOCATION_OLD);
237 return std::string("");
241 * Set discoveryChannel properties to be delivered to Enrollee
243 * @param discoveryChannel Channel of the Enroller for fast discover
245 void setDiscoveryChannel(int discoveryChannel)
247 m_rep.setValue(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL, discoveryChannel);
251 * Get an channel of Enroller
253 * @return an channel of enroller
255 int getDiscoveryChannel()
257 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL))
259 return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_DISCOVERY_CHANNEL);
261 return INVALID_DISCOVERY_CHANNEL;
265 * Set samsung-specific location property to be delivered to Enrollee
267 * @param locations a set of location information
269 void setSCLocation(const std::vector<std::string> &locations)
271 m_rep.setValue(SC_RSRVD_ES_VENDOR_LOCATION, locations);
275 * Set samsung account property to be delivered to Enrollee (for TV)
277 * @param account a samsung account ID information (for TV)
279 void setSCAccount(const std::string &account)
281 m_rep.setValue(SC_RSRVD_ES_VENDOR_ACCOUNT, account);
285 * Set UTC date time property to be delivered to Enrollee.
286 * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
288 * @param datetime UTC date time
290 void setUTCDatetime(const std::string &datetime)
292 m_rep.setValue(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME, datetime);
296 * Get UTC date time property
298 * @return UTC date time
300 std::string getUTCDatetime()
302 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
304 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
310 * Set regional date time property to be delivered to Enrollee.
311 * The format is "[yyyy]-[mm]-[dd]T[hh]:[mm]:[ss]Z"
313 * @param datetime Regional date time
315 void setRegionalDatetime(const std::string &datetime)
317 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME, datetime);
321 * Get regional date time property
325 std::string getRegionalDatetime()
327 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
329 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
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).
340 * @param regMobileDev register mobile device
342 void setRegisterMobileDevice(const std::string ®MobileDev)
344 m_rep.setValue(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV, regMobileDev);
348 * Get Mobile device information used for 'register TV'
350 * @return register mobile device
352 std::string getRegisterMobileDevice()
354 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV))
356 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_MOBILE_DEV);
362 * Set a BSSID of Enroller
364 * @param a BSSID of enroller
366 void setBSSID(const std::string &bssid)
368 m_rep.setValue(SC_RSRVD_ES_VENDOR_BSSID, bssid);
372 * Get a BSSID of Enroller
374 * @return a BSSID of enroller
376 std::string getBSSID()
378 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
380 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
386 * Set SSO list information
390 void setSSOList(const std::string &ssoList)
392 m_rep.setValue(SC_RSRVD_ES_VENDOR_SSO_LIST, ssoList);
396 * Get SSO List information which is registered in device
400 std::string getSSOList()
402 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
404 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
410 * Set Candidate AP information which is stored.
412 * @param clientID - Client service ID
414 void setCandidateAPList(SCCandidateAPInfo *candidateInfo,int numCandidateAP)
416 std::vector<OC::OCRepresentation> candidateAPList;
417 for (int i=0;i<numCandidateAP;i++)
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);
426 m_rep.setValue(SC_RSRVD_ES_VENDOR_CANDIDATEAPS, candidateAPList);
430 * Get Candidate AP information which is registered in device.
432 * @return SCCandidateAPInfo list.
434 std::vector<SCCandidateAPInfo> getCandidateAPList()
436 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
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)
444 OC::OCRepresentation rep = *it;
445 SCCandidateAPInfo candidateInfotemp;
446 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID))
448 candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID);
450 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE))
452 candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE);
454 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
456 candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
459 if (rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID))
461 candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID);
463 postcandidateInfo.push_back(candidateInfotemp);
465 return postcandidateInfo;
471 * Set time zone for location based services when easy-setup is done
473 * @param Name of timeZone
475 void setTimeZoneId(const std::string &timeZoneId)
477 m_rep.setValue(SC_RSRVD_ES_VENDOR_TIMEZONE_ID, timeZoneId);
481 * Get the Name of TimeZone
483 * @return Name of timeZone
485 std::string getTimeZoneId()
487 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TIMEZONE_ID))
489 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TIMEZONE_ID);
495 * Sets the hidden property of wifi
496 * if the Value is true, wifi is a hidden wifi, otherwise it is not
498 * @param isHidden: value indicating whether the wifi is hidden or not
500 void setHiddenProperty(bool isHidden)
502 m_rep.setValue(SC_RSRVD_ES_VENDOR_HIDDEN, isHidden);
506 * Gets the property of the wifi whether it is hidden or not
508 * @return hidden value indicating whether the wifi is hidden or not
510 bool getHiddenProperty()
512 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_HIDDEN))
514 return m_rep.getValue<bool>(SC_RSRVD_ES_VENDOR_HIDDEN);
520 class SCCloudProp : public CloudProp
524 * Set samsung-specific client service ID property to be delivered to Enrollee
526 * @param clientID - Client service ID
528 void setClientID(const std::string &clientID)
530 m_rep.setValue(SC_RSRVD_ES_VENDOR_CLIENTID, clientID);
534 * Get samsung-specific client service ID property.
536 * @return Client service ID.
538 std::string getClientID()
540 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_CLIENTID))
542 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CLIENTID);
548 * Set samsung-specific additional AuthCode property to be delivered to Enrollee (for TV/AV sign up VD SSO)
550 * @param additionalAuthcode - additional AuthCode (for TV/AV sign up VD SSO)
552 void setAdditionalAuthCode(const std::string &additionalAuthcode)
554 m_rep.setValue(SC_RSRVD_ES_VENDOR_ADDITIONAL_AUTH_CODE, additionalAuthcode);
558 * Set samsung-specific additional Api provider to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO)
560 * @param additionalApiProvider - additional Api Provider
562 void setAdditionalApiProvider(const std::string &additionalApiProvider)
564 m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_API_SERVER, additionalApiProvider);
568 * Get samsung-specific additional Api provider (for devices(TV/AV, Lux) sign up SSO)
570 * @return additionalApiProvider - additional Api Provider
572 std::string getAdditionalApiProvider()
574 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_API_SERVER))
576 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SA_API_SERVER);
582 * Set samsung-specific additional Auth provider to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO)
584 * @param additionalAuthProvider - additional Auth Provider
586 void setAdditionalAuthProvider(const std::string &additionalAuthProvider)
588 m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER, additionalAuthProvider);
592 * Get samsung-specific additional Auth provider (for devices(TV/AV, Lux) sign up SSO)
594 * @return additionalAuthProvider - additional Auth Provider
596 std::string getAdditionalAuthProvider()
598 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER))
600 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SA_AUTH_SERVER);
606 * Set samsung-specific additional device security code to be delivered to Enrollee (for devices(TV/AV, Lux) sign up SSO)
608 * @param additionalDeviceSecCode - additional DeviceSecurityCode (for devices(TV/AV, Lux) sign up VD SSO)
610 void setAdditionalDeviceSecCode(const std::string &additionalDeviceSecCode)
612 m_rep.setValue(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE, additionalDeviceSecCode);
616 * Get samsung-specific additional device security code
618 * @return additionalDeviceSecCode - additional DeviceSecurityCode
620 std::string getAdditionalDeviceSecCode()
622 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE))
624 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SA_DEVICE_SECURITY_CODE);
630 * Set current deployment environment which IoT Server is operating such as "PRD" "STG"
632 * @param serverDeploymentEnv - current server Deployment Environment
634 void setServerDeploymentEnv(const std::string &serverDeploymentEnv)
636 m_rep.setValue(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT, serverDeploymentEnv);
640 * Get current server deployment environment which IoT Server is operating such as "PRD", "STG" etc
642 * @return serverDeploymentEnv - current server deployment environment
644 std::string getServerDeploymentEnv()
646 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT))
648 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEPLOY_ENVIRONMENT);
654 * Set Access token type.
656 * @param type - Access token type
658 void setAccessTokenType(const int type)
660 m_rep.setValue(SC_RSRVD_ES_VENDOR_IATT, type);
664 * Get Access token type.
666 * @return Access token type.
668 int getAccessTokenType(void)
670 if (m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_IATT))
672 return m_rep.getValue<int>(SC_RSRVD_ES_VENDOR_IATT);
678 * Set samsung-specific refresh token property to be delivered to Enrollee
680 * @param refreshtoken - Refresh token.
682 void setRefreshToken(const std::string &refreshtoken)
684 m_rep.setValue(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN, refreshtoken);
688 * Get samsung-specific refresh token property.
690 * @return refreshtoken - Refresh token.
692 std::string getRefreshToken()
694 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN))
696 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REFRESH_TOKEN);
702 * Set samsung-specific user ID property to be delivered to Enrollee
704 * @param uid - user ID.
706 void setUserID(const std::string &uid)
708 m_rep.setValue(SC_RSRVD_ES_VENDOR_USERID, uid);
712 * Get samsung-specific user ID property
714 * @return uid - user ID.
716 std::string getUserID()
718 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_USERID))
720 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_USERID);
727 * Indicates T&C result by mobile user in json format.
729 * @param uid - user ID.
731 void setTCResult(const std::string &result)
733 m_rep.setValue(SC_RSRVD_ES_VENDOR_TC_RESULT, result);
739 * @return uid - user ID.
741 std::string getTCResult()
743 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_RESULT))
745 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_RESULT);
751 * Set samsung-specific client service ID property to be delivered to Enrollee
753 * @param clientID - Client service ID
755 void setServerId(const std::string &serverId)
757 m_rep.setValue(SC_RSRVD_ES_VENDOR_SERVER_ID, serverId);
761 * Get samsung-specific client service ID property.
763 * @return Client service ID.
765 std::string getServerId()
767 if(m_rep.hasAttribute(SC_RSRVD_ES_VENDOR_SERVER_ID))
769 return m_rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SERVER_ID);
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
781 class SCEnrolleeConf : public EnrolleeConf
784 SCEnrolleeConf(const EnrolleeConf&& parent) : EnrolleeConf(parent)
789 * Get a model number of Enrollee.
791 * @return a model number of Enrollee
793 std::string getModelNumber() const
795 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
796 for(auto child = children.begin(); child != children.end(); ++child)
798 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
800 OCRepresentation rep;
801 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
803 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
807 return std::string("");
810 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER))
812 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_MODEL_NUMBER);
814 else if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD))
816 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_MODEL_NUMBER_OLD);
820 return std::string("");
824 * Get a device type of Enrollee.
825 * It is Device's human-friendly name like device model name.
827 * @return a device type of Enrollee
829 std::string getDeviceType() const
831 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
832 for(auto child = children.begin(); child != children.end(); ++child)
834 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
836 OCRepresentation rep;
837 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
839 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
843 return std::string("");
846 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_TYPE))
848 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_TYPE);
852 return std::string("");
856 * Get a device sub-type of Enrollee.
857 * It is Device's human-friendly name like device model name.
859 * @return a device sub-type of Enrollee
861 std::string getDeviceSubType() const
863 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
864 for(auto child = children.begin(); child != children.end(); ++child)
866 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
868 OCRepresentation rep;
869 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
871 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
875 return std::string("");
878 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE))
880 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_DEVICE_SUBTYPE);
884 return std::string("");
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)
893 * @return Register Set Device
895 std::string getRegisterSetDevice() const
897 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
898 for(auto child = children.begin(); child != children.end(); ++child)
900 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
902 OCRepresentation rep;
903 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
905 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
909 return std::string("");
912 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV))
914 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGISTER_SET_DEV);
918 return std::string("");
922 * Get Candidate AP information which is registered in device.
924 * @return SCCandidateAPInfo list.
926 std::vector<SCCandidateAPInfo> getCandidateAPList() const
928 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
929 for(auto child = children.begin(); child != children.end(); ++child)
931 if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
933 OCRepresentation rep;
934 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
936 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
939 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATEAPS))
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)
946 OC::OCRepresentation rep = *it;
947 SCCandidateAPInfo candidateInfotemp;
948 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID))
950 candidateInfotemp.ssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_SSID);
952 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE))
954 candidateInfotemp.passphrase=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_PASSPHRASE);
956 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL))
958 candidateInfotemp.channel=rep.getValue<int>(SC_RSRVD_ES_VENDOR_CANDIDATE_CHANNEL);
961 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID))
963 candidateInfotemp.bssid=rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_CANDIDATE_BSSID);
965 postcandidateInfo.push_back(candidateInfotemp);
967 return postcandidateInfo;
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)
981 * @return Network Provisioning Information String.
983 std::string getNetworkProvisioningInfo() const
985 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
986 for(auto child = children.begin(); child != children.end(); ++child)
988 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
990 OCRepresentation rep;
991 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
993 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
997 return std::string("");
1000 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO))
1002 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_NETWORK_PROV_INFO);
1006 return std::string("");
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,
1015 * @return SSo List Information String.
1017 std::string getSSOList() const
1019 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1020 for(auto child = children.begin(); child != children.end(); ++child)
1022 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1024 OCRepresentation rep;
1025 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1027 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1031 return std::string("");
1034 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_SSO_LIST))
1036 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_SSO_LIST);
1040 return std::string("");
1045 * Indicates T&C is already agreed or not.
1047 * @return T&C Status
1051 TC_STATUS getTCStatus()
1053 OCRepresentation rep;
1054 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
1056 rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1060 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
1063 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_STATUS))
1065 return static_cast<TC_STATUS>
1066 (rep.getValue<int>(SC_RSRVD_ES_VENDOR_TC_STATUS));
1069 return TC_STATUS::TC_STATUS_NOT_SUPPORTED;
1074 * T&C Header Information in json format
1076 * @return T&C Header
1078 std::string getTCHeader()
1080 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1081 for(auto child = children.begin(); child != children.end(); ++child)
1083 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1085 OCRepresentation rep;
1086 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1088 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1092 return std::string("");
1095 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_HEADER))
1097 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_HEADER);
1101 return std::string("");
1107 * @return T&C Version
1109 std::string getTCVersion()
1111 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1112 for(auto child = children.begin(); child != children.end(); ++child)
1114 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1116 OCRepresentation rep;
1117 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1119 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1123 return std::string("");
1126 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_TC_VERSION))
1128 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_TC_VERSION);
1132 return std::string("");
1140 std::string getPnpPin() const
1142 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1143 for(auto child = children.begin(); child != children.end(); ++child)
1145 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1147 OCRepresentation rep;
1148 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1150 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1154 return std::string("");
1157 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_PNP_PIN))
1159 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_PNP_PIN);
1163 return std::string("");
1167 * Get a network connection state property of Enrollee.
1169 * @return a network connection state property of Enrollee.
1171 NETCONNECTION_STATE getNetConnectionState() const
1173 OCRepresentation rep;
1174 if(m_EasySetupRep.hasAttribute(OC_RSRVD_REPRESENTATION))
1176 rep = m_EasySetupRep.getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1180 return NETCONNECTION_STATE::NET_STATE_INIT;
1183 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE))
1185 return static_cast<NETCONNECTION_STATE>
1186 (rep.getValue<int>(SC_RSRVD_ES_VENDOR_NETCONNECTION_STATE));
1189 return NETCONNECTION_STATE::NET_STATE_INIT;
1193 * Get a BSSID of Enroller
1195 * @return a BSSID of enroller
1197 std::string getBSSID() const
1199 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1200 for(auto child = children.begin(); child != children.end(); ++child)
1202 if(child->getUri().find(OC_RSRVD_ES_URI_WIFICONF) != std::string::npos)
1204 OCRepresentation rep;
1205 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1207 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1211 return std::string("");
1214 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_BSSID))
1216 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_BSSID);
1226 * @return UTC date time
1228 std::string getUTCDatetime() const
1230 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1231 for(auto child = children.begin(); child != children.end(); ++child)
1233 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1235 OCRepresentation rep;
1236 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1238 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1242 return std::string("");
1245 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME))
1247 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_UTC_DATE_TIME);
1255 * Get regional date time
1259 std::string getRegionalDatetime() const
1261 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1262 for(auto child = children.begin(); child != children.end(); ++child)
1264 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1266 OCRepresentation rep;
1267 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1269 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1273 return std::string("");
1276 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME))
1278 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_REGIONAL_DATE_TIME);
1286 * Get Samsung Easy Setup Protocol Version.
1288 * Mediator can use this API to differentiate between Easy Setup Protcol supported by
1289 * Samsung Enrollee Devices.
1291 * Example: Version Value for Tizen4.0: [
\932.0
\94]
1293 * @return Easy Setup Protocol Version String.
1295 std::string getESProtocolVersion() const
1297 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1298 for(auto child = children.begin(); child != children.end(); ++child)
1300 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1302 OCRepresentation rep;
1303 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1305 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1309 return std::string("");
1312 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION))
1314 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_ES_PROTOCOL_VERSION);
1318 return std::string("");
1322 * Gets the ISO country code of the device
1323 * (ISO 3166-1 Alpha-2)
1325 * @return the ISO Country code of the device
1327 std::string getCountry() const
1329 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1330 for(auto child = children.begin(); child != children.end(); ++child)
1332 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1334 OCRepresentation rep;
1335 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1337 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1341 return std::string("");
1344 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_COUNTRY))
1346 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_COUNTRY);
1350 return std::string("");
1354 * Gets the HubId of the device
1356 * @return hubId of the device
1358 std::string getHubId() const
1360 std::vector<OCRepresentation> children = m_EasySetupRep.getChildren();
1361 for(auto child = children.begin(); child != children.end(); ++child)
1363 if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos)
1365 OCRepresentation rep;
1366 if(child->hasAttribute(OC_RSRVD_REPRESENTATION))
1368 rep = child->getValue<OCRepresentation>(OC_RSRVD_REPRESENTATION);
1372 return std::string("");
1375 if(rep.hasAttribute(SC_RSRVD_ES_VENDOR_HUB_ID))
1377 return rep.getValue<std::string>(SC_RSRVD_ES_VENDOR_HUB_ID);
1381 return std::string("");
1388 #endif //ESSC_COMMON_RICH_H_