[CA-Integration] Added code to get connectivity type from C to C++ layer
authorSudarshan Prasad <sudarshan.prasad@intel.com>
Thu, 25 Dec 2014 06:51:42 +0000 (22:51 -0800)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Thu, 25 Dec 2014 07:47:53 +0000 (23:47 -0800)
Change-Id: I5afd5269595c5d45b355e10e6c9400f66dc74ef9
Signed-off-by:Sudarshan Prasad<sudarshan.prasad@intel.com>

resource/include/OCSerialization.h
resource/src/InProcClientWrapper.cpp

index 2872813..b0bf50a 100644 (file)
@@ -186,9 +186,15 @@ namespace OC
                 ar(resources);
             }
         public:
+#ifdef CA_INT
+            ListenOCContainer(std::weak_ptr<IClientWrapper> cw, const OCDevAddr& address,
+                    uint8_t connectivityType, std::stringstream& json):
+                m_clientWrapper(cw), m_address(address), m_connectivityType(connectivityType)
+#else
             ListenOCContainer(std::weak_ptr<IClientWrapper> cw, const OCDevAddr& address,
                     std::stringstream& json):
                 m_clientWrapper(cw), m_address(address)
+#endif
             {
                 LoadFromJson(json);
             }
@@ -269,12 +275,10 @@ namespace OC
                         if(res.loaded())
                         {
 #ifdef CA_INT
-                            //CA_TODO: To get the connectivity type correctly.
-                            uint8_t connectivityType;
                             m_resources.push_back(std::shared_ptr<OCResource>(
                                 new OCResource(m_clientWrapper,
                                     ConvertOCAddrToString(res.secureType(),res.port()),
-                                    res.m_uri, res.m_serverId, connectivityType, res.observable(),
+                                    res.m_uri, res.m_serverId, m_connectivityType, res.observable(),
                                     res.resourceTypes(), res.interfaces())));
 #else
                             m_resources.push_back(std::shared_ptr<OCResource>(
@@ -296,5 +300,6 @@ namespace OC
             std::vector<std::shared_ptr<OC::OCResource>> m_resources;
             std::weak_ptr<IClientWrapper> m_clientWrapper;
             OCDevAddr m_address;
+            uint8_t m_connectivityType;
     };
 }
index 9fd3153..35ff469 100644 (file)
@@ -148,9 +148,13 @@ namespace OC
 
         try
         {
+#ifdef CA_INT
+            ListenOCContainer container(clientWrapper, *clientResponse->addr,
+                    clientResponse->connType, requestStream);
+#else
             ListenOCContainer container(clientWrapper, *clientResponse->addr,
                     requestStream);
-
+#endif
             // loop to ensure valid construction of all resources
             for(auto resource : container.Resources())
             {