From: Heewon Park Date: Fri, 12 Aug 2016 01:55:32 +0000 (+0900) Subject: Update Common data model's Constructor & change security '.dat' files. X-Git-Tag: 1.2.0+RC1~129 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5f27a7957a758a6669973a4e222dbd43dbb571b;p=platform%2Fupstream%2Fiotivity.git Update Common data model's Constructor & change security '.dat' files. Change-Id: I30a6aa0abe2b52b637fd86045bd0a81ababcb921 Signed-off-by: Heewon Park Reviewed-on: https://gerrit.iotivity.org/gerrit/10313 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- diff --git a/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h b/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h index 0a3300a..411c0a0 100755 --- a/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h +++ b/service/easy-setup/mediator/richsdk/inc/ESRichCommon.h @@ -123,7 +123,17 @@ namespace OIC */ CloudProp() { - }; + } + + CloudProp(const CloudProp& cloudProp) : + m_rep(cloudProp.toOCRepresentation()), m_cloudID(cloudProp.getCloudID()) + { + } + + CloudProp(const CloudProp&& cloudProp) : + m_rep(std::move(cloudProp.toOCRepresentation())), m_cloudID(cloudProp.getCloudID()) + { + } /** * Constructor with OCRepresentation object. This is used for JNI communication. @@ -235,7 +245,19 @@ namespace OIC /** * Constructor */ - DeviceProp() {} + DeviceProp() + { + } + + DeviceProp(const DeviceProp& deviceProp) : + m_rep(deviceProp.toOCRepresentation()) + { + } + + DeviceProp(const DeviceProp&& deviceProp) : + m_rep(std::move(deviceProp.toOCRepresentation())) + { + } /** * Constructor with OCRepresentation object. This is used for JNI communication. @@ -431,27 +453,19 @@ namespace OIC * OCRepresentation object corresponding to WiFi, DevConf, and CloudServer resource's * representation. */ - EnrolleeConf(const OCRepresentation& rep) + EnrolleeConf(const OCRepresentation& rep) : + m_ProvRep(rep) { - m_ProvRep = rep; + } - std::vector children = rep.getChildren(); + EnrolleeConf(const EnrolleeConf& enrolleeConf) : + m_ProvRep(enrolleeConf.getProvResRep()) + { + } - for(auto child = children.begin(); child != children.end(); ++child) - { - if(child->getUri().find(OC_RSRVD_ES_URI_WIFI) != std::string::npos) - { - m_WiFiRep = *child; - } - else if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos) - { - m_DevConfRep = *child; - } - else if(child->getUri().find(OC_RSRVD_ES_URI_CLOUDSERVER) != std::string::npos) - { - m_CloudRep = *child; - } - } + EnrolleeConf(const EnrolleeConf&& enrolleeConf) : + m_ProvRep(std::move(enrolleeConf.getProvResRep())) + { } /** @@ -462,8 +476,17 @@ namespace OIC */ std::string getDeviceName() const { - if(m_DevConfRep.hasAttribute(OC_RSRVD_ES_DEVNAME)) - return m_DevConfRep.getValue(OC_RSRVD_ES_DEVNAME); + std::vector children = m_ProvRep.getChildren(); + for(auto child = children.begin(); child != children.end(); ++child) + { + if(child->getUri().find(OC_RSRVD_ES_URI_DEVCONF) != std::string::npos) + { + if(child->hasAttribute(OC_RSRVD_ES_DEVNAME)) + { + return child->getValue(OC_RSRVD_ES_DEVNAME); + } + } + } return std::string(""); } @@ -479,12 +502,19 @@ namespace OIC vector modes; modes.clear(); - if(m_WiFiRep.hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIMODE)) + std::vector children = m_ProvRep.getChildren(); + for(auto child = children.begin(); child != children.end(); ++child) + { + if(child->getUri().find(OC_RSRVD_ES_URI_WIFI) != std::string::npos) + { + if(child->hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIMODE)) { - for(auto it : m_WiFiRep.getValue + for(auto it : child->getValue >(OC_RSRVD_ES_SUPPORTEDWIFIMODE)) { modes.push_back(static_cast(it)); + } + } } } return modes; @@ -499,9 +529,18 @@ namespace OIC */ WIFI_FREQ getWiFiFreq() const { - if(m_WiFiRep.hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIFREQ)) - return static_cast( - m_WiFiRep.getValue(OC_RSRVD_ES_SUPPORTEDWIFIFREQ)); + std::vector children = m_ProvRep.getChildren(); + for(auto child = children.begin(); child != children.end(); ++child) + { + if(child->getUri().find(OC_RSRVD_ES_URI_WIFI) != std::string::npos) + { + if(child->hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIFREQ)) + { + return static_cast( + child->getValue(OC_RSRVD_ES_SUPPORTEDWIFIFREQ)); + } + } + } return WIFI_FREQ_NONE; } @@ -512,9 +551,13 @@ namespace OIC */ bool isCloudAccessible() const { - if(m_CloudRep.getUri().find(OC_RSRVD_ES_URI_CLOUDSERVER) != std::string::npos) + std::vector children = m_ProvRep.getChildren(); + for(auto child = children.begin(); child != children.end(); ++child) { - return true; + if(child->getUri().find(OC_RSRVD_ES_URI_CLOUDSERVER) != std::string::npos) + { + return true; + } } return false; } @@ -524,13 +567,13 @@ namespace OIC * * @return OCRepresentation object */ - const OCRepresentation& getProvResRep() + const OCRepresentation& getProvResRep() const { return m_ProvRep; } protected: - OCRepresentation m_ProvRep, m_WiFiRep, m_DevConfRep, m_CloudRep; + OCRepresentation m_ProvRep; }; /** @@ -585,7 +628,7 @@ namespace OIC return m_result; } - const EnrolleeConf& getEnrolleeConf() + EnrolleeConf& getEnrolleeConf() { return m_enrolleeConf; } @@ -613,7 +656,6 @@ namespace OIC return m_result; } - private: ESResult m_result; }; diff --git a/service/easy-setup/sampleapp/enrollee/linux/oic_svr_db_server.dat b/service/easy-setup/sampleapp/enrollee/linux/oic_svr_db_server.dat old mode 100755 new mode 100644 index 08c7368..07b0d53 Binary files a/service/easy-setup/sampleapp/enrollee/linux/oic_svr_db_server.dat and b/service/easy-setup/sampleapp/enrollee/linux/oic_svr_db_server.dat differ diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat index 3884c30..4b5b918 100644 Binary files a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat and b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat differ diff --git a/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat b/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat old mode 100755 new mode 100644 index 62fd559..4b5b918 Binary files a/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat and b/service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat differ