Updated C++ SDK for discovering secure resources
authorSachin Agrawal <sachin.agrawal@intel.com>
Mon, 6 Jul 2015 23:51:54 +0000 (16:51 -0700)
committerSachin Agrawal <sachin.agrawal@intel.com>
Tue, 7 Jul 2015 16:43:15 +0000 (16:43 +0000)
On discovering secure resources, OCResource object needs to be
updated with 'secure' flag and appropriate port for secure resource.

Change-Id: I0a09ae1e6d9bcc73b7d97b9dcaae02955d63cb2d
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1545
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: sandeep sharma <sandeep.s9@samsung.com>
Reviewed-by: Woochul Shim <woochul.shim@samsung.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/include/OCSerialization.h

index 96b4b35801cefc4891e390c894f7eeeda7bd072f..f709736f427ee2212eb1c88e1f3165440199cacb 100644 (file)
@@ -242,6 +242,15 @@ namespace OC
                     {
                         if(res.loaded())
                         {
+                            if (res.secureType() == OCSecureType::Secure)
+                            {
+                                m_devAddr.flags =
+                                    (OCTransportFlags)(OC_FLAG_SECURE | m_devAddr.flags);
+                            }
+                            if (res.port() != -1)
+                            {
+                                m_devAddr.port = res.port();
+                            }
                             m_resources.push_back(std::shared_ptr<OCResource>(
                                 new OCResource(m_clientWrapper, m_devAddr,
                                     res.m_uri, res.m_serverId, res.observable(),
@@ -258,6 +267,6 @@ namespace OC
             }
             std::vector<std::shared_ptr<OC::OCResource>> m_resources;
             std::weak_ptr<IClientWrapper> m_clientWrapper;
-            const OCDevAddr& m_devAddr;
+            OCDevAddr m_devAddr;
     };
 }