Update Common data model's Constructor & change security '.dat' files.
authorHeewon Park <h_w.park@samsung.com>
Fri, 12 Aug 2016 01:55:32 +0000 (10:55 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Fri, 12 Aug 2016 05:17:26 +0000 (05:17 +0000)
Change-Id: I30a6aa0abe2b52b637fd86045bd0a81ababcb921
Signed-off-by: Heewon Park <h_w.park@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10313
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/easy-setup/mediator/richsdk/inc/ESRichCommon.h
service/easy-setup/sampleapp/enrollee/linux/oic_svr_db_server.dat [changed mode: 0755->0644]
service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/assets/oic_svr_db_client.dat
service/easy-setup/sampleapp/mediator/linux/richsdk_sample/oic_svr_db_client.dat [changed mode: 0755->0644]

index 0a3300ad7b8f3f0e08b13ec891051b9a859cd234..411c0a072607edf3a0bfe71f05c85d1e4ebeeaaf 100755 (executable)
@@ -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<OCRepresentation> 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<std::string>(OC_RSRVD_ES_DEVNAME);
+                std::vector<OCRepresentation> 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<std::string>(OC_RSRVD_ES_DEVNAME);
+                        }
+                    }
+                }
                 return std::string("");
             }
 
@@ -479,12 +502,19 @@ namespace OIC
                 vector<WIFI_MODE> modes;
                 modes.clear();
 
-                if(m_WiFiRep.hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIMODE))
+                std::vector<OCRepresentation> 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
                                         <std::vector<int>>(OC_RSRVD_ES_SUPPORTEDWIFIMODE))
                     {
                         modes.push_back(static_cast<WIFI_MODE>(it));
+                            }
+                        }
                     }
                 }
                 return modes;
@@ -499,9 +529,18 @@ namespace OIC
              */
             WIFI_FREQ getWiFiFreq() const
             {
-                if(m_WiFiRep.hasAttribute(OC_RSRVD_ES_SUPPORTEDWIFIFREQ))
-                    return static_cast<WIFI_FREQ>(
-                                        m_WiFiRep.getValue<int>(OC_RSRVD_ES_SUPPORTEDWIFIFREQ));
+                std::vector<OCRepresentation> 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<WIFI_FREQ>(
+                                        child->getValue<int>(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<OCRepresentation> 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;
         };
old mode 100755 (executable)
new mode 100644 (file)
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
index 3884c30bfdbbbd64492928d51ed393fd5b5e19d2..4b5b91881ba480a4828e70405952a02ec9c50892 100644 (file)
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
old mode 100755 (executable)
new mode 100644 (file)
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