[CA-Integration] Added connectivity type param in APIs
authorSudarshan Prasad <sudarshan.prasad@intel.com>
Wed, 24 Dec 2014 01:51:05 +0000 (17:51 -0800)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Wed, 24 Dec 2014 23:38:25 +0000 (15:38 -0800)
Signed-off-by: Sudarshan Prasad <sudarshan.prasad@intel.com>
Change-Id: I368885126b5db6182708627312776b9d6da1f7f6

26 files changed:
resource/csdk/stack/include/ocstack.h
resource/csdk/stack/src/ocstack.c
resource/examples/devicediscoveryclient.cpp
resource/examples/fridgeclient.cpp
resource/examples/garageclient.cpp
resource/examples/groupclient.cpp
resource/examples/groupserver.cpp
resource/examples/makefile
resource/examples/presenceclient.cpp
resource/examples/roomclient.cpp
resource/examples/simpleclient.cpp
resource/examples/simpleclientHQ.cpp
resource/examples/simpleclientserver.cpp
resource/examples/threadingsample.cpp
resource/include/IClientWrapper.h
resource/include/InProcClientWrapper.h
resource/include/OCPlatform.h
resource/include/OCPlatform_impl.h
resource/include/OCResource.h
resource/include/OCSerialization.h
resource/include/OutOfProcClientWrapper.h
resource/makefile
resource/src/InProcClientWrapper.cpp
resource/src/OCPlatform.cpp
resource/src/OCPlatform_impl.cpp
resource/src/OCResource.cpp

index 8be0d12..eba9044 100644 (file)
@@ -333,6 +333,15 @@ typedef enum {
     OC_STACK_KEEP_TRANSACTION
 } OCStackApplicationResult;
 
+#ifdef CA_INT
+typedef enum {
+    OC_ETHERNET = (1 << 0),
+    OC_WIFI = (1 << 1),
+    OC_EDR = (1 << 2),
+    OC_LE = (1 << 3)
+} OCConnectivityType;
+#endif
+
 //-----------------------------------------------------------------------------
 // Callback function definitions
 //-----------------------------------------------------------------------------
@@ -447,9 +456,16 @@ OCStackResult OCProcess();
  *     OC_STACK_INVALID_QUERY    - number of resource types specified for filtering presence
  *                                 notifications exceeds @ref MAX_PRESENCE_FILTERS.
  */
-OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char  *requiredUri, const char  *referenceUri,
-                const char *request, OCQualityOfService qos, OCCallbackData *cbData, OCHeaderOption * options,
+#ifdef CA_INT
+OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char  *requiredUri,
+                const char  *referenceUri, const char *request, uint8_t conType,
+                OCQualityOfService qos, OCCallbackData *cbData, OCHeaderOption * options,
                 uint8_t numOptions);
+#else
+OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char  *requiredUri,
+                const char  *referenceUri, const char *request, OCQualityOfService qos,
+                OCCallbackData *cbData, OCHeaderOption * options, uint8_t numOptions);
+#endif
 
 /**
  * Cancel a request associated with a specific @ref OCDoResource invocation.
index 87ed18d..aa56c0a 100644 (file)
@@ -1080,11 +1080,17 @@ OCStackResult verifyUriQueryLength(const char *inputUri, uint16_t uriLen)
  *     OC_STACK_INVALID_METHOD   - invalid resource method
  *     OC_STACK_INVALID_URI      - invalid required or reference URI
  */
-
+#ifdef CA_INT
+OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char *requiredUri,
+                           const char *referenceUri, const char *request, uint8_t conType,
+                           OCQualityOfService qos, OCCallbackData *cbData,
+                           OCHeaderOption * options, uint8_t numOptions)
+#else
 OCStackResult OCDoResource(OCDoHandle *handle, OCMethod method, const char *requiredUri,
                            const char *referenceUri, const char *request,
                            OCQualityOfService qos, OCCallbackData *cbData,
                            OCHeaderOption * options, uint8_t numOptions)
+#endif
 {
     OCStackResult result = OC_STACK_ERROR;
     OCCoAPToken token;
index f08a8c7..4bc412c 100644 (file)
@@ -125,7 +125,13 @@ int main() {
     OCPlatform::Configure(cfg);
     try
     {
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+        OCPlatform::getDeviceInfo("", "coap://224.0.1.187/oc/core/d", connectivityType,
+                                  &receivedDeviceInfo);
+#else
         OCPlatform::getDeviceInfo("", "coap://224.0.1.187/oc/core/d", &receivedDeviceInfo);
+#endif
         std::cout<< "Querying for device information... " <<std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index a37c581..30420b3 100644 (file)
@@ -44,9 +44,14 @@ class ClientFridge
     {
         std::cout << "Fridge Client has started " <<std::endl;
         FindCallback f (std::bind(&ClientFridge::foundDevice, this, PH::_1));
-
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+        OCStackResult result = OCPlatform::findResource(
+                "", "coap://224.0.1.187/oc/core?rt=intel.fridge", connectivityType, f);
+#else
         OCStackResult result = OCPlatform::findResource(
                 "", "coap://224.0.1.187/oc/core?rt=intel.fridge", f);
+#endif
 
         if(OC_STACK_OK != result)
         {
@@ -79,8 +84,14 @@ class ClientFridge
         // server, and query them.
         std::vector<std::string> lightTypes = {"intel.fridge.light"};
         std::vector<std::string> ifaces = {DEFAULT_INTERFACE};
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+        OCResource::Ptr light = constructResourceObject(resource->host(),
+                                "/light", connectivityType, false, lightTypes, ifaces);
+#else
         OCResource::Ptr light = constructResourceObject(resource->host(),
                                 "/light", false, lightTypes, ifaces);
+#endif
 
         if(!light)
         {
@@ -89,25 +100,41 @@ class ClientFridge
         }
 
         std::vector<std::string> doorTypes = {"intel.fridge.door"};
-
+#ifdef CA_INT
+        OCResource::Ptr leftdoor = constructResourceObject(resource->host(),
+                                "/door/left", connectivityType, false, doorTypes, ifaces);
+#else
         OCResource::Ptr leftdoor = constructResourceObject(resource->host(),
                                 "/door/left", false, doorTypes, ifaces);
+#endif
+
         if(!leftdoor)
         {
             std::cout << "Error: Left Door Resource Object construction returned null\n";
             return;
         }
 
+#ifdef CA_INT
+        OCResource::Ptr rightdoor = constructResourceObject(resource->host(),
+                                "/door/right", connectivityType, false, doorTypes, ifaces);
+#else
         OCResource::Ptr rightdoor = constructResourceObject(resource->host(),
                                 "/door/right", false, doorTypes, ifaces);
+#endif
+
         if(!rightdoor)
         {
             std::cout << "Error: Right Door Resource Object construction returned null\n";
             return;
         }
 
+#ifdef CA_INT
+        OCResource::Ptr randomdoor = constructResourceObject(resource->host(),
+                                "/door/random", connectivityType, false, doorTypes, ifaces);
+#else
         OCResource::Ptr randomdoor = constructResourceObject(resource->host(),
                                 "/door/random", false, doorTypes, ifaces);
+#endif
         if(!randomdoor)
         {
             std::cout << "Error: Random Door Resource Object construction returned null\n";
index ba8a09a..392a501 100644 (file)
@@ -282,8 +282,14 @@ int main(int argc, char* argv[]) {
     try
     {
         // Find all resources
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+        OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.garage",
+                    connectivityType, &foundResource);
+#else
         OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.garage",
                     &foundResource);
+#endif
         std::cout<< "Finding Resource... " <<std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index 11afb80..4e5e654 100755 (executable)
@@ -133,7 +133,13 @@ int main()
         OCPlatform::Configure(config);
 
         string resourceTypeName = "a.collection";
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+        OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=a.collection",
+                                 connectivityType, &foundResource);
+#else
         OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=a.collection", &foundResource);
+#endif
 
         isReady = false;
 
index 4cebd44..4ebb2d6 100755 (executable)
@@ -101,7 +101,14 @@ int main()
 
         cout << "registerResource is called." << endl;
 
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+        OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.light",
+                                 connectivityType, &foundResource);
+#else
         OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.light", &foundResource);
+#endif
+
         OCPlatform::bindInterfaceToResource(resourceHandle, GROUP_INTERFACE);
         OCPlatform::bindInterfaceToResource(resourceHandle, DEFAULT_INTERFACE);
 
index 3387126..bc411b8 100755 (executable)
@@ -26,9 +26,10 @@ CXX        := g++
 #CXX     := clang
 OUT_DIR          := $(BUILD)
 
-CXX_FLAGS.debug     := -O0 -g3 -std=c++0x -Wall -pthread
+#TODO-CA Remove the CA Flag later
+CXX_FLAGS.debug     := -O0 -g3 -std=c++0x -Wall -pthread -DCA_INT
 
-CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread
+CXX_FLAGS.release   := -O3 -std=c++0x -Wall -pthread -DCA_INT
 
 CXX_INC          := -I../include/
 CXX_INC   += -I../oc_logger/include
@@ -117,8 +118,8 @@ devicediscoveryserver: devicediscoveryserver.cpp
 
 devicediscoveryclient: devicediscoveryclient.cpp
        $(CXX) $(CXX_FLAGS.$(BUILD)) -o $(OUT_DIR)/$@ devicediscoveryclient.cpp $(CXX_INC) $(CXX_LIBS)
-       
-       
+
+
 
 ocicuc_target:
        cd ocicuc && $(MAKE) apps
index 857d0f4..2d0a9d0 100644 (file)
@@ -132,11 +132,19 @@ void foundResource(std::shared_ptr<OCResource> resource)
                 OCStackResult result = OC_STACK_OK;
                 curResource = resource;
                 OCPlatform::OCPresenceHandle presenceHandle = nullptr;
+#ifdef CA_INT
+                OCConnectivityType connectivityType = OC_WIFI;
+#endif
 
                 if(TEST_CASE == TEST_UNICAST_PRESENCE_NORMAL)
                 {
+#ifdef CA_INT
+                    result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
+                            connectivityType, &presenceHandler);
+#else
                     result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
                             &presenceHandler);
+#endif
                     if(result == OC_STACK_OK)
                     {
                         std::cout<< "Subscribed to unicast address: " << hostAddress << std::endl;
@@ -150,8 +158,13 @@ void foundResource(std::shared_ptr<OCResource> resource)
                 if(TEST_CASE == TEST_UNICAST_PRESENCE_WITH_FILTER ||
                         TEST_CASE == TEST_UNICAST_PRESENCE_WITH_FILTERS)
                 {
+#ifdef CA_INT
+                    result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
+                            "core.light", connectivityType, &presenceHandler);
+#else
                     result = OCPlatform::subscribePresence(presenceHandle, hostAddress,
                             "core.light", &presenceHandler);
+#endif
                     if(result == OC_STACK_OK)
                     {
                         std::cout<< "Subscribed to unicast address: " << hostAddress;
@@ -164,8 +177,13 @@ void foundResource(std::shared_ptr<OCResource> resource)
                 }
                 if(TEST_CASE == TEST_UNICAST_PRESENCE_WITH_FILTERS)
                 {
+#ifdef CA_INT
+                    result = OCPlatform::subscribePresence(presenceHandle, hostAddress, "core.fan",
+                            connectivityType, &presenceHandler);
+#else
                     result = OCPlatform::subscribePresence(presenceHandle, hostAddress, "core.fan",
                             &presenceHandler);
+#endif
                     if(result == OC_STACK_OK)
                     {
                         std::cout<< "Subscribed to unicast address: " << hostAddress;
@@ -229,11 +247,20 @@ int main(int argc, char* argv[]) {
 
         OCPlatform::OCPresenceHandle presenceHandle = nullptr;
         OCStackResult result = OC_STACK_OK;
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+#endif
 
         if(TEST_CASE == TEST_MULTICAST_PRESENCE_NORMAL)
         {
+#ifdef CA_INT
+            result = OCPlatform::subscribePresence(presenceHandle,
+                    OC_MULTICAST_IP, connectivityType, presenceHandler);
+#else
             result = OCPlatform::subscribePresence(presenceHandle,
                     OC_MULTICAST_IP, presenceHandler);
+#endif
+
             if(result == OC_STACK_OK)
             {
                 std::cout << "Subscribed to multicast presence." << std::endl;
@@ -245,8 +272,13 @@ int main(int argc, char* argv[]) {
         }
         else if(TEST_CASE == TEST_MULTICAST_PRESENCE_WITH_FILTER)
         {
+#ifdef CA_INT
+            result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.light",
+                    connectivityType, &presenceHandler);
+#else
             result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.light",
                     &presenceHandler);
+#endif
             if(result == OC_STACK_OK)
             {
                 std::cout << "Subscribed to multicast presence with resource type";
@@ -259,8 +291,13 @@ int main(int argc, char* argv[]) {
         }
         else if(TEST_CASE == TEST_MULTICAST_PRESENCE_WITH_FILTERS)
         {
+#ifdef CA_INT
+            result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.light",
+                    connectivityType, &presenceHandler);
+#else
             result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.light",
                     &presenceHandler);
+#endif
             if(result == OC_STACK_OK)
             {
                 std::cout << "Subscribed to multicast presence with resource type";
@@ -271,8 +308,13 @@ int main(int argc, char* argv[]) {
             }
             std::cout << "\"core.light\"." << std::endl;
 
+#ifdef CA_INT
+            result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.fan",
+                    connectivityType, &presenceHandler);
+#else
             result = OCPlatform::subscribePresence(presenceHandle, OC_MULTICAST_IP, "core.fan",
                     &presenceHandler);
+#endif
             if(result == OC_STACK_OK)
             {
                 std::cout<< "Subscribed to multicast presence with resource type";
@@ -286,7 +328,13 @@ int main(int argc, char* argv[]) {
         else
         {
             // Find all resources
+#ifdef CA_INT
+            OCConnectivityType connectivityType = OC_WIFI;
+            result = OCPlatform::findResource("", "coap://224.0.1.187/oc/core",
+                     connectivityType, &foundResource);
+#else
             result = OCPlatform::findResource("", "coap://224.0.1.187/oc/core", &foundResource);
+#endif
             if(result == OC_STACK_OK)
             {
                 std::cout << "Finding Resource... " << std::endl;
index 7e73597..3cf5540 100644 (file)
@@ -233,7 +233,14 @@ int main(int argc, char* argv[]) {
     try
     {
         // Find all resources
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+        OCPlatform::findResource("", "coap://224.0.1.187/oc/core", connectivityType,
+            &foundResource);
+#else
         OCPlatform::findResource("", "coap://224.0.1.187/oc/core", &foundResource);
+#endif
+
         std::cout<< "Finding Resource... " <<std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index 85c0dc1..0451ddb 100644 (file)
@@ -371,7 +371,13 @@ int main(int argc, char* argv[]) {
         // makes it so that all boolean values are printed as 'true/false' in this stream
         std::cout.setf(std::ios::boolalpha);
         // Find all resources
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+        OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.light",
+                    connectivityType, &foundResource);
+#else
         OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.light", &foundResource);
+#endif
         std::cout<< "Finding Resource... " <<std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index e3a6f2c..a215ef0 100644 (file)
@@ -384,8 +384,14 @@ int main(int argc, char* argv[]) {
     try
     {
         // Find all resources
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+        OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.light",
+                connectivityType, &foundResource, OC::QualityOfService::LowQos);
+#else
         OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.light", &foundResource,
                 OC::QualityOfService::LowQos);
+#endif
         std::cout<< "Finding Resource... " <<std::endl;
 
         // A condition variable will free the mutex it is given, then do a non-
index d3ee18b..763af03 100644 (file)
@@ -146,9 +146,17 @@ public:
     {
         std::cout<<"Starting Client find:"<<std::endl;
         FindCallback f (std::bind(&ClientWorker::foundResource, this, std::placeholders::_1));
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
         std::cout<<"result:" <<
-            OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.foo", f)
-            << std::endl;
+        OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.foo", connectivityType, f)
+        << std::endl;
+#else
+        std::cout<<"result:" <<
+        OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.foo", f)
+        << std::endl;
+#endif
+
         std::cout<<"Finding Resource..."<<std::endl;
 
         {
index ff556e2..b092c1a 100644 (file)
@@ -280,9 +280,14 @@ void foundResource1(std::shared_ptr<OCResource> resource)
 void client1()
 {
     std::cout << "in client1\n";
-
+#ifdef CA_INT
+    OCConnectivityType connectivityType = OC_WIFI;
+    std::cout<<"result1:" << OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.foo",
+            connectivityType, foundResource1)<< std::endl;
+#else
     std::cout<<"result1:" << OCPlatform::findResource("", "coap://224.0.1.187/oc/core?rt=core.foo",
             foundResource1)<< std::endl;
+#endif
 
     // A condition variable will free the mutex it is given, then do a non-
     // intensive block until 'notify' is called on it.  In this case, since we
@@ -297,10 +302,16 @@ void client1()
 void client2()
 {
     std::cout << "in client2\n";
-
+#ifdef CA_INT
+        OCConnectivityType connectivityType = OC_WIFI;
+    std::cout<<"result2:" << OCPlatform::findResource("",
+                "coap://224.0.1.187/oc/core?rt=core.foo",
+                connectivityType, foundResource2)<< std::endl;
+#else
     std::cout<<"result2:" << OCPlatform::findResource("",
                 "coap://224.0.1.187/oc/core?rt=core.foo",
                 foundResource2)<< std::endl;
+#endif
 
     // A condition variable will free the mutex it is given, then do a non-
     // intensive block until 'notify' is called on it.  In this case, since we
index 1e40e23..31a9591 100644 (file)
@@ -40,6 +40,44 @@ namespace OC
         IClientWrapper()
         {}
 
+#ifdef CA_INT
+        virtual OCStackResult ListenForResource(const std::string& serviceUrl,
+                        const std::string& resourceType, uint8_t connectivityType,
+                        FindCallback& callback,
+                        QualityOfService QoS) = 0;
+
+        virtual OCStackResult ListenForDevice(const std::string& serviceUrl,
+                        const std::string& deviceURI, uint8_t connectivityType,
+                        FindDeviceCallback& callback,
+                        QualityOfService QoS) = 0;
+
+        virtual OCStackResult GetResourceRepresentation(const std::string& host,
+                        const std::string& uri, uint8_t connectivityType,
+                        const QueryParamsMap& queryParams,
+                        const HeaderOptions& headerOptions,
+                        GetCallback& callback, QualityOfService QoS)=0;
+
+        virtual OCStackResult PutResourceRepresentation(const std::string& host,
+                        const std::string& uri, uint8_t connectivityType,
+                        const OCRepresentation& rep, const QueryParamsMap& queryParams,
+                        const HeaderOptions& headerOptions,
+                        PutCallback& callback, QualityOfService QoS) = 0;
+
+        virtual OCStackResult PostResourceRepresentation(const std::string& host,
+                        const std::string& uri, uint8_t connectivityType,
+                        const OCRepresentation& rep, const QueryParamsMap& queryParams,
+                        const HeaderOptions& headerOptions,
+                        PostCallback& callback, QualityOfService QoS) = 0;
+
+        virtual OCStackResult DeleteResource(const std::string& host, const std::string& uri,
+                        uint8_t connectivityType, const HeaderOptions& headerOptions,
+                        DeleteCallback& callback, QualityOfService QoS) = 0;
+
+        virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle,
+                        const std::string& host, const std::string& uri, uint8_t connectivityType,
+                        const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
+                        ObserveCallback& callback, QualityOfService QoS)=0;
+#else
         virtual OCStackResult ListenForResource(const std::string& serviceUrl,
                         const std::string& resourceType, FindCallback& callback,
                         QualityOfService QoS) = 0;
@@ -71,13 +109,18 @@ namespace OC
                         const std::string& host, const std::string& uri,
                         const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
                         ObserveCallback& callback, QualityOfService QoS)=0;
-
+#endif
         virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host,
             const std::string& uri, const HeaderOptions& headerOptions, QualityOfService QoS)=0;
 
+#ifdef CA_INT
+        virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
+                        const std::string& resourceType, uint8_t connectivityType,
+                        SubscribeCallback& presenceHandler)=0;
+#else
         virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
                         const std::string& resourceType, SubscribeCallback& presenceHandler)=0;
-
+#endif
         virtual OCStackResult UnsubscribePresence(OCDoHandle handle) =0;
 
         virtual OCStackResult GetDefaultQos(QualityOfService& qos) = 0;
index ced111d..0d29b9d 100644 (file)
@@ -83,6 +83,39 @@ namespace OC
                             PlatformConfig cfg);
         virtual ~InProcClientWrapper();
 
+#ifdef CA_INT
+        virtual OCStackResult ListenForResource(const std::string& serviceUrl,
+            const std::string& resourceType, uint8_t connectivityType, FindCallback& callback,
+            QualityOfService QoS);
+
+        virtual OCStackResult ListenForDevice(const std::string& serviceUrl,
+            const std::string& deviceURI, uint8_t connectivityType, FindDeviceCallback& callback,
+            QualityOfService QoS);
+
+        virtual OCStackResult GetResourceRepresentation(const std::string& host,
+            const std::string& uri, uint8_t connectivityType, const QueryParamsMap& queryParams,
+            const HeaderOptions& headerOptions,
+            GetCallback& callback, QualityOfService QoS);
+
+        virtual OCStackResult PutResourceRepresentation(const std::string& host,
+            const std::string& uri, uint8_t connectivityType, const OCRepresentation& attributes,
+            const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
+            PutCallback& callback, QualityOfService QoS);
+
+        virtual OCStackResult PostResourceRepresentation(const std::string& host,
+            const std::string& uri, uint8_t connectivityType, const OCRepresentation& attributes,
+            const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
+            PostCallback& callback, QualityOfService QoS);
+
+        virtual OCStackResult DeleteResource(const std::string& host, const std::string& uri,
+            uint8_t connectivityType, const HeaderOptions& headerOptions,
+            DeleteCallback& callback, QualityOfService QoS);
+
+        virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle,
+            const std::string& host, const std::string& uri, uint8_t connectivityType,
+            const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
+            ObserveCallback& callback, QualityOfService QoS);
+#else
         virtual OCStackResult ListenForResource(const std::string& serviceUrl,
             const std::string& resourceType, FindCallback& callback,
             QualityOfService QoS);
@@ -112,12 +145,18 @@ namespace OC
         virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle,
             const std::string& host, const std::string& uri, const QueryParamsMap& queryParams,
             const HeaderOptions& headerOptions, ObserveCallback& callback, QualityOfService QoS);
-
+#endif
         virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host,
             const std::string& uri, const HeaderOptions& headerOptions, QualityOfService QoS);
 
+#ifdef CA_INT
+        virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
+            const std::string& resourceType, uint8_t connectivityType,
+            SubscribeCallback& presenceHandler);
+#else
         virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
             const std::string& resourceType, SubscribeCallback& presenceHandler);
+#endif
 
         virtual OCStackResult UnsubscribePresence(OCDoHandle handle);
         OCStackResult GetDefaultQos(QualityOfService& QoS);
index 1cad339..8639dbe 100644 (file)
@@ -114,11 +114,17 @@ namespace OC
         * as BTH etc.
         * NOTE: OCStackResult is defined in ocstack.h.
         */
+#ifdef CA_INT
+        OCStackResult findResource(const std::string& host, const std::string& resourceURI,
+                    uint8_t connectivityType, FindCallback resourceHandler);
+        OCStackResult findResource(const std::string& host, const std::string& resourceURI,
+                    uint8_t connectivityType, FindCallback resourceHandler, QualityOfService QoS);
+#else
         OCStackResult findResource(const std::string& host, const std::string& resourceURI,
                     FindCallback resourceHandler);
         OCStackResult findResource(const std::string& host, const std::string& resourceURI,
                     FindCallback resourceHandler, QualityOfService QoS);
-
+#endif
         /**
          * API for Device Discovery
          *
@@ -129,11 +135,18 @@ namespace OC
          * @param QualityOfService the quality of communication
          *
          */
+#ifdef CA_INT
+        OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
+                    uint8_t connectivityType, FindDeviceCallback deviceInfoHandler);
+        OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
+                    uint8_t connectivityType, FindDeviceCallback deviceInfoHandler,
+                    QualityOfService QoS);
+#else
         OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
                     FindDeviceCallback deviceInfoHandler);
         OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
                     FindDeviceCallback deviceInfoHandler, QualityOfService QoS);
-
+#endif
         /**
         * This API registers a resource with the server
         * NOTE: This API applies to server side only.
@@ -381,11 +394,18 @@ namespace OC
         *
         * @return OCStackResult - return value of the API.  Returns OCSTACK_OK if success <br>
         */
+#ifdef CA_INT
+        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
+                        uint8_t connectivityType, SubscribeCallback presenceHandler);
+        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
+                        const std::string& resourceType, uint8_t connectivityType,
+                        SubscribeCallback presenceHandler);
+#else
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
                         SubscribeCallback presenceHandler);
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
                         const std::string& resourceType, SubscribeCallback presenceHandler);
-
+#endif
         /**
         * unsubscribes from a previously subscribed server's presence events. Note that
         * you may for a short time still receive events from the server since it may take time
@@ -423,10 +443,16 @@ namespace OC
         * @param interfaces - a collection of interfaces that the resource supports/implements
         * @return OCResource::Ptr - a shared pointer to the new resource object
         */
+#ifdef CA_INT
+        OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri,
+                        uint8_t connectivityType, bool isObservable,
+                        const std::vector<std::string>& resourceTypes,
+                        const std::vector<std::string>& interfaces);
+#else
         OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri,
                         bool isObservable, const std::vector<std::string>& resourceTypes,
                         const std::vector<std::string>& interfaces);
-
+#endif
         /**
         * Allows application entity handler to send response to an incoming request.
         *
index f25ce2e..b4d4810 100644 (file)
@@ -140,11 +140,17 @@ namespace OC
         * as BTH etc.
         * NOTE: OCStackResult is defined in ocstack.h.
         */
+#ifdef CA_INT
+        OCStackResult findResource(const std::string& host, const std::string& resourceURI,
+                    uint8_t connectivityType, FindCallback resourceHandler);
+        OCStackResult findResource(const std::string& host, const std::string& resourceURI,
+                    uint8_t connectivityType, FindCallback resourceHandler, QualityOfService QoS);
+#else
         OCStackResult findResource(const std::string& host, const std::string& resourceURI,
                     FindCallback resourceHandler);
         OCStackResult findResource(const std::string& host, const std::string& resourceURI,
                     FindCallback resourceHandler, QualityOfService QoS);
-
+#endif
         /**
          * API for Device Discovery
          *
@@ -155,11 +161,18 @@ namespace OC
          * @param QualityOfService the quality of communication
          *
          */
+#ifdef CA_INT
+        OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
+                    uint8_t connectivityType, FindDeviceCallback deviceInfoHandler);
+        OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
+                    uint8_t connectivityType, FindDeviceCallback deviceInfoHandler,
+                    QualityOfService QoS);
+#else
         OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
                     FindDeviceCallback deviceInfoHandler);
         OCStackResult getDeviceInfo(const std::string& host, const std::string& deviceURI,
                     FindDeviceCallback deviceInfoHandler, QualityOfService QoS);
-
+#endif
         /**
         * This API registers a resource with the server
         * NOTE: This API applies to server side only.
@@ -403,11 +416,18 @@ namespace OC
         *
         * @return OCStackResult - return value of the API.  Returns OCSTACK_OK if success <br>
         */
+#ifdef CA_INT
+        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
+                        uint8_t connectivityType, SubscribeCallback presenceHandler);
+        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
+                        const std::string& resourceType, uint8_t connectivityType,
+                        SubscribeCallback presenceHandler);
+#else
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
                         SubscribeCallback presenceHandler);
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host,
                         const std::string& resourceType, SubscribeCallback presenceHandler);
-
+#endif
         /**
         * unsubscribes from a previously subscribed server's presence events. Note that
         * you may for a short time still receive events from the server since it may take time
@@ -445,10 +465,16 @@ namespace OC
         * @param interfaces - a collection of interfaces that the resource supports/implements
         * @return OCResource::Ptr - a shared pointer to the new resource object
         */
+#ifdef CA_INT
+        OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri,
+                        uint8_t connectivityType, bool isObservable,
+                        const std::vector<std::string>& resourceTypes,
+                        const std::vector<std::string>& interfaces);
+#else
         OCResource::Ptr constructResourceObject(const std::string& host, const std::string& uri,
                         bool isObservable, const std::vector<std::string>& resourceTypes,
                         const std::vector<std::string>& interfaces);
-
+#endif
         /**
         * Allows application entity handler to send response to an incoming request.
         *
index 63c4253..cf9bded 100644 (file)
@@ -274,6 +274,14 @@ namespace OC
         */
         std::string uri() const;
 
+#ifdef CA_INT
+        /**
+        * Function to get the connectivity type of this resource
+        * @return uint8_t connectivity type
+        */
+        uint8_t connectivityType() const;
+#endif
+
         /**
         * Function to provide ability to check if this resource is observable or not
         * @return bool true indicates resource is observable; false indicates resource is
@@ -303,6 +311,9 @@ namespace OC
         std::weak_ptr<IClientWrapper> m_clientWrapper;
         std::string m_uri;
         std::string m_host;
+#ifdef CA_INT
+        uint8_t m_connectivityType;
+#endif
         bool m_isObservable;
         bool m_isCollection;
         std::vector<std::string> m_resourceTypes;
@@ -312,9 +323,17 @@ namespace OC
         HeaderOptions m_headerOptions;
 
     private:
+#ifdef CA_INT
+        OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
+            const std::string& uri, uint8_t m_connectivityType, bool observable,
+            const std::vector<std::string>& resourceTypes,
+            const std::vector<std::string>& interfaces);
+#else
         OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
-            const std::string& uri, bool observable, const std::vector<std::string>& resourceTypes,
+            const std::string& uri, bool observable,
+            const std::vector<std::string>& resourceTypes,
             const std::vector<std::string>& interfaces);
+#endif
     };
 
 } // namespace OC
index f611407..ff47918 100644 (file)
@@ -258,11 +258,21 @@ 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, connectivityType, res.observable(), res.resourceTypes(),
+                                    res.interfaces())));
+#else
                             m_resources.push_back(std::shared_ptr<OCResource>(
                                 new OCResource(m_clientWrapper,
                                     ConvertOCAddrToString(res.secureType(),res.port()),
                                     res.m_uri, res.observable(), res.resourceTypes(),
                                     res.interfaces())));
+#endif
                         }
 
                     }
index 049c445..0654a36 100644 (file)
@@ -32,6 +32,45 @@ namespace OC
                                 PlatformConfig cfg)
         {}
 
+#ifdef CA_INT
+        virtual OCStackResult ListenForResource(const std::string& serviceUrl,
+            const std::string& resourceType, uint8_t connectivityType,
+            FindCallback& callback, QualityOfService QoS)
+            {return OC_STACK_NOTIMPL;}
+
+        virtual OCStackResult ListenForDevice(const std::string& serviceUrl,
+            const std::string& deviceURI, uint8_t connectivityType, FindDeviceCallback& callback,
+            QualityOfService QoS)
+            {return OC_STACK_NOTIMPL;}
+
+        virtual OCStackResult GetResourceRepresentation(const std::string& host,
+            const std::string& uri, uint8_t connectivityType, const QueryParamsMap& queryParams,
+            const HeaderOptions& headerOptions, GetCallback& callback,
+            QualityOfService QoS)
+            {return OC_STACK_NOTIMPL;}
+
+        virtual OCStackResult PutResourceRepresentation(const std::string& host,
+            const std::string& uri, uint8_t connectivityType, const OCRepresentation& attributes,
+            const QueryParamsMap& queryParams,
+            const HeaderOptions& headerOptions, PutCallback& callback,
+            QualityOfService QoS)
+            {return OC_STACK_NOTIMPL;}
+
+        virtual OCStackResult PostResourceRepresentation(const std::string& host,
+            const std::string& uri, uint8_t connectivityType, const OCRepresentation& attributes,
+            const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
+            PostCallback& callback, QualityOfService QoS)
+            {return OC_STACK_NOTIMPL;}
+
+        virtual OCStackResult DeleteResource(const std::string& host, const std::string& uri,
+            uint8_t connectivityType, const HeaderOptions& headerOptions, DeleteCallback& callback,
+            QualityOfService QoS) {return OC_STACK_NOTIMPL;}
+
+        virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle,
+            const std::string& host, const std::string& uri, uint8_t connectivityType,
+            const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
+            ObserveCallback& callback, QualityOfService QoS){return OC_STACK_NOTIMPL;}
+#else
         virtual OCStackResult ListenForResource(const std::string& serviceUrl,
             const std::string& resourceType, FindCallback& callback, QualityOfService QoS)
             {return OC_STACK_NOTIMPL;}
@@ -68,15 +107,20 @@ namespace OC
             const std::string& host, const std::string& uri, const QueryParamsMap& queryParams,
             const HeaderOptions& headerOptions,
             ObserveCallback& callback, QualityOfService QoS){return OC_STACK_NOTIMPL;}
-
+#endif
         virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host,
             const std::string& uri,
             const HeaderOptions& headerOptions, QualityOfService QoS){return OC_STACK_NOTIMPL;}
-
+#ifdef CA_INT
+        virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
+            const std::string& resourceType, uint8_t connectivityType,
+            SubscribeCallback& presenceHandler)
+        {return OC_STACK_NOTIMPL;}
+#else
         virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
             const std::string& resourceType, SubscribeCallback& presenceHandler)
         {return OC_STACK_NOTIMPL;}
-
+#endif
         virtual OCStackResult UnsubscribePresence(OCDoHandle handle){return OC_STACK_NOTIMPL;}
 
         virtual OCStackResult GetDefaultQos(QualityOfService& QoS){return OC_STACK_NOTIMPL;}
index a710781..b6b1833 100644 (file)
@@ -37,8 +37,9 @@ CEREAL_DIR:= $(DEPEND_DIR)/cereal
 OUT_DIR          := $(ROOT_DIR)/$(BUILD)
 OBJ_DIR          := $(OUT_DIR)/obj
 
-CXX_FLAGS.debug     := -g3 -std=c++0x -Wall -pthread -O0
-CXX_FLAGS.release   := -std=c++0x -Wall -pthread -O3
+#TODO-CA Need to remove flag later
+CXX_FLAGS.debug     := -g3 -std=c++0x -Wall -pthread -O0 -DCA_INT
+CXX_FLAGS.release   := -std=c++0x -Wall -pthread -O3 -DCA_INT
 
 CXX_INC          := -I./include/
 CXX_INC          += -I./oc_logger/include
index 83e4ef8..4244b5a 100644 (file)
@@ -172,8 +172,14 @@ namespace OC
         return OC_STACK_KEEP_TRANSACTION;
     }
 
+#ifdef CA_INT
+    OCStackResult InProcClientWrapper::ListenForResource(const std::string& serviceUrl,
+        const std::string& resourceType, uint8_t connectivityType,
+        FindCallback& callback, QualityOfService QoS)
+#else
     OCStackResult InProcClientWrapper::ListenForResource(const std::string& serviceUrl,
         const std::string& resourceType, FindCallback& callback, QualityOfService QoS)
+#endif
     {
         OCStackResult result;
 
@@ -192,12 +198,21 @@ namespace OC
         {
             std::lock_guard<std::recursive_mutex> lock(*cLock);
             OCDoHandle handle;
+#ifdef CA_INT
+            result = OCDoResource(&handle, OC_REST_GET,
+                                  resourceType.c_str(),
+                                  nullptr, nullptr, connectivityType,
+                                  static_cast<OCQualityOfService>(QoS),
+                                  &cbdata,
+                                  NULL, 0);
+#else
             result = OCDoResource(&handle, OC_REST_GET,
                                   resourceType.c_str(),
                                   nullptr, nullptr,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   NULL, 0);
+#endif
         }
         else
         {
@@ -220,8 +235,14 @@ namespace OC
         return OC_STACK_KEEP_TRANSACTION;
     }
 
+#ifdef CA_INT
+    OCStackResult InProcClientWrapper::ListenForDevice(const std::string& serviceUrl,
+        const std::string& deviceURI, uint8_t connectivityType,
+        FindDeviceCallback& callback, QualityOfService QoS)
+#else
     OCStackResult InProcClientWrapper::ListenForDevice(const std::string& serviceUrl,
         const std::string& deviceURI, FindDeviceCallback& callback, QualityOfService QoS)
+#endif
     {
         OCStackResult result;
 
@@ -241,12 +262,21 @@ namespace OC
         {
             std::lock_guard<std::recursive_mutex> lock(*cLock);
             OCDoHandle handle;
+#ifdef CA_INT
+            result = OCDoResource(&handle, OC_REST_GET,
+                                  deviceURI.c_str(),
+                                  nullptr, nullptr, connectivityType,
+                                  static_cast<OCQualityOfService>(QoS),
+                                  &cbdata,
+                                  NULL, 0);
+#else
             result = OCDoResource(&handle, OC_REST_GET,
                                   deviceURI.c_str(),
                                   nullptr, nullptr,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   NULL, 0);
+#endif
         }
         else
         {
@@ -300,10 +330,17 @@ namespace OC
         return OC_STACK_DELETE_TRANSACTION;
     }
 
+#ifdef CA_INT
+    OCStackResult InProcClientWrapper::GetResourceRepresentation(const std::string& host,
+        const std::string& uri, uint8_t connectivityType, const QueryParamsMap& queryParams,
+        const HeaderOptions& headerOptions, GetCallback& callback,
+        QualityOfService QoS)
+#else
     OCStackResult InProcClientWrapper::GetResourceRepresentation(const std::string& host,
         const std::string& uri, const QueryParamsMap& queryParams,
         const HeaderOptions& headerOptions, GetCallback& callback,
         QualityOfService QoS)
+#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -326,11 +363,19 @@ namespace OC
             OCHeaderOption options[MAX_HEADER_OPTIONS];
 
             assembleHeaderOptions(options, headerOptions);
+#ifdef CA_INT
+            result = OCDoResource(&handle, OC_REST_GET, os.str().c_str(),
+                                  nullptr, nullptr, connectivityType,
+                                  static_cast<OCQualityOfService>(QoS),
+                                  &cbdata,
+                                  options, headerOptions.size());
+#else
             result = OCDoResource(&handle, OC_REST_GET, os.str().c_str(),
                                   nullptr, nullptr,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   options, headerOptions.size());
+#endif
         }
         else
         {
@@ -398,10 +443,17 @@ namespace OC
         return ocInfo.getJSONRepresentation(OCInfoFormat::IncludeOC);
     }
 
+#ifdef CA_INT
+    OCStackResult InProcClientWrapper::PostResourceRepresentation(const std::string& host,
+        const std::string& uri, uint8_t connectivityType, const OCRepresentation& rep,
+        const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
+        PostCallback& callback, QualityOfService QoS)
+#else
     OCStackResult InProcClientWrapper::PostResourceRepresentation(const std::string& host,
         const std::string& uri, const OCRepresentation& rep,
         const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
         PostCallback& callback, QualityOfService QoS)
+#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -426,11 +478,19 @@ namespace OC
             OCDoHandle handle;
 
             assembleHeaderOptions(options, headerOptions);
+#ifdef CA_INT
+            result = OCDoResource(&handle, OC_REST_POST,
+                                  os.str().c_str(), nullptr,
+                                  assembleSetResourcePayload(rep).c_str(), connectivityType,
+                                  static_cast<OCQualityOfService>(QoS),
+                                  &cbdata, options, headerOptions.size());
+#else
             result = OCDoResource(&handle, OC_REST_POST,
                                   os.str().c_str(), nullptr,
                                   assembleSetResourcePayload(rep).c_str(),
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata, options, headerOptions.size());
+#endif
         }
         else
         {
@@ -441,11 +501,17 @@ namespace OC
         return result;
     }
 
-
+#ifdef CA_INT
+    OCStackResult InProcClientWrapper::PutResourceRepresentation(const std::string& host,
+        const std::string& uri, uint8_t connectivityType, const OCRepresentation& rep,
+        const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
+        PutCallback& callback, QualityOfService QoS)
+#else
     OCStackResult InProcClientWrapper::PutResourceRepresentation(const std::string& host,
         const std::string& uri, const OCRepresentation& rep,
         const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
         PutCallback& callback, QualityOfService QoS)
+#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -470,12 +536,21 @@ namespace OC
             OCHeaderOption options[MAX_HEADER_OPTIONS];
 
             assembleHeaderOptions(options, headerOptions);
+#ifdef CA_INT
+            result = OCDoResource(&handle, OC_REST_PUT,
+                                  os.str().c_str(), nullptr,
+                                  assembleSetResourcePayload(rep).c_str(), connectivityType,
+                                  static_cast<OCQualityOfService>(QoS),
+                                  &cbdata,
+                                  options, headerOptions.size());
+#else
             result = OCDoResource(&handle, OC_REST_PUT,
                                   os.str().c_str(), nullptr,
                                   assembleSetResourcePayload(rep).c_str(),
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   options, headerOptions.size());
+#endif
         }
         else
         {
@@ -502,9 +577,15 @@ namespace OC
         return OC_STACK_DELETE_TRANSACTION;
     }
 
+#ifdef CA_INT
+    OCStackResult InProcClientWrapper::DeleteResource(const std::string& host,
+        const std::string& uri, uint8_t connectivityType, const HeaderOptions& headerOptions,
+         DeleteCallback& callback, QualityOfService QoS)
+#else
     OCStackResult InProcClientWrapper::DeleteResource(const std::string& host,
         const std::string& uri, const HeaderOptions& headerOptions,
          DeleteCallback& callback, QualityOfService QoS)
+#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -528,11 +609,18 @@ namespace OC
             assembleHeaderOptions(options, headerOptions);
 
             std::lock_guard<std::recursive_mutex> lock(*cLock);
-
+#ifdef CA_INT
+            result = OCDoResource(&handle, OC_REST_DELETE,
+                                  os.str().c_str(), nullptr,
+                                  nullptr, connectivityType,
+                                  static_cast<OCQualityOfService>(m_cfg.QoS),
+                                  &cbdata, options, headerOptions.size());
+#else
             result = OCDoResource(&handle, OC_REST_DELETE,
                                   os.str().c_str(), nullptr,
                                   nullptr, static_cast<OCQualityOfService>(m_cfg.QoS),
                                   &cbdata, options, headerOptions.size());
+#endif
         }
         else
         {
@@ -563,9 +651,16 @@ namespace OC
         return OC_STACK_KEEP_TRANSACTION;
     }
 
+#ifdef CA_INT
+    OCStackResult InProcClientWrapper::ObserveResource(ObserveType observeType, OCDoHandle* handle,
+        const std::string& host, const std::string& uri, uint8_t connectivityType,
+        const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
+        ObserveCallback& callback, QualityOfService QoS)
+#else
     OCStackResult InProcClientWrapper::ObserveResource(ObserveType observeType, OCDoHandle* handle,
         const std::string& host, const std::string& uri, const QueryParamsMap& queryParams,
         const HeaderOptions& headerOptions, ObserveCallback& callback, QualityOfService QoS)
+#endif
     {
         OCStackResult result;
         OCCallbackData cbdata = {0};
@@ -601,12 +696,21 @@ namespace OC
             OCHeaderOption options[MAX_HEADER_OPTIONS];
 
             assembleHeaderOptions(options, headerOptions);
+#ifdef CA_INT
+            result = OCDoResource(handle, method,
+                                  os.str().c_str(), nullptr,
+                                  nullptr, connectivityType,
+                                  static_cast<OCQualityOfService>(QoS),
+                                  &cbdata,
+                                  options, headerOptions.size());
+#else
             result = OCDoResource(handle, method,
                                   os.str().c_str(), nullptr,
                                   nullptr,
                                   static_cast<OCQualityOfService>(QoS),
                                   &cbdata,
                                   options, headerOptions.size());
+#endif
         }
         else
         {
@@ -669,9 +773,15 @@ namespace OC
         return OC_STACK_KEEP_TRANSACTION;
     }
 
+#ifdef CA_INT
+    OCStackResult InProcClientWrapper::SubscribePresence(OCDoHandle* handle,
+        const std::string& host, const std::string& resourceType, uint8_t connectivityType,
+        SubscribeCallback& presenceHandler)
+#else
     OCStackResult InProcClientWrapper::SubscribePresence(OCDoHandle* handle,
         const std::string& host, const std::string& resourceType,
         SubscribeCallback& presenceHandler)
+#endif
     {
         OCCallbackData cbdata = {0};
 
@@ -698,8 +808,13 @@ namespace OC
             return OC_STACK_ERROR;
         }
 
+#ifdef CA_INT
+        return OCDoResource(handle, OC_REST_PRESENCE, os.str().c_str(), nullptr, nullptr,
+                            connectivityType, OC_LOW_QOS, &cbdata, NULL, 0);
+#else
         return OCDoResource(handle, OC_REST_PRESENCE, os.str().c_str(), nullptr, nullptr,
                             OC_LOW_QOS, &cbdata, NULL, 0);
+#endif
     }
 
     OCStackResult InProcClientWrapper::UnsubscribePresence(OCDoHandle handle)
index 9a17833..c5f1773 100644 (file)
@@ -70,6 +70,55 @@ namespace OC
                                                     observationIds, pResponse, QoS);
         }
 
+#ifdef CA_INT
+        OCResource::Ptr constructResourceObject(const std::string& host,
+                                                const std::string& uri, uint8_t connectivityType,
+                                                bool isObservable,
+                                                const std::vector<std::string>& resourceTypes,
+                                                const std::vector<std::string>& interfaces)
+        {
+            return OCPlatform_impl::Instance().constructResourceObject(host, uri, connectivityType, 
+                                                isObservable,
+                                                resourceTypes, interfaces);
+        }
+
+        OCStackResult findResource(const std::string& host,
+                                                const std::string& resourceName,
+                                                uint8_t connectivityType,
+                                                FindCallback resourceHandler)
+        {
+            return OCPlatform_impl::Instance().findResource(host, resourceName,
+                   connectivityType, resourceHandler);
+        }
+
+        OCStackResult findResource(const std::string& host,
+                                                const std::string& resourceName,
+                                                uint8_t connectivityType,
+                                                FindCallback resourceHandler, QualityOfService QoS)
+        {
+            return OCPlatform_impl::Instance().findResource(host, resourceName, connectivityType,
+                                                resourceHandler, QoS);
+        }
+
+        OCStackResult getDeviceInfo(const std::string& host,
+                                                const std::string& deviceURI,
+                                                uint8_t connectivityType,
+                                                FindDeviceCallback deviceInfoHandler)
+        {
+            return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI,
+                   connectivityType, deviceInfoHandler);
+        }
+
+        OCStackResult getDeviceInfo(const std::string& host,
+                                                const std::string& deviceURI,
+                                                uint8_t connectivityType,
+                                                FindDeviceCallback deviceInfoHandler,
+                                                QualityOfService QoS)
+        {
+            return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI, connectivityType,
+                    deviceInfoHandler, QoS);
+        }
+#else
         OCResource::Ptr constructResourceObject(const std::string& host,
                                                 const std::string& uri,
                                                 bool isObservable,
@@ -110,7 +159,7 @@ namespace OC
             return OCPlatform_impl::Instance().getDeviceInfo(host, deviceURI,
                     deviceInfoHandler, QoS);
         }
-
+#endif
 
         OCStackResult registerResource(OCResourceHandle& resourceHandle,
                                                 std::string& resourceURI,
@@ -189,6 +238,26 @@ namespace OC
             return OCPlatform_impl::Instance().stopPresence();
         }
 
+#ifdef CA_INT
+        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
+                                                const std::string& host,
+                                                uint8_t connectivityType,
+                                                SubscribeCallback presenceHandler)
+        {
+            return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
+                                                connectivityType, presenceHandler);
+        }
+
+        OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
+                                                const std::string& host,
+                                                const std::string& resourceType,
+                                                uint8_t connectivityType,
+                                                SubscribeCallback presenceHandler)
+        {
+            return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
+                                                resourceType, connectivityType, presenceHandler);
+        }
+#else
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle,
                                                 const std::string& host,
                                                 SubscribeCallback presenceHandler)
@@ -205,7 +274,7 @@ namespace OC
             return OCPlatform_impl::Instance().subscribePresence(presenceHandle, host,
                                                 resourceType, presenceHandler);
         }
-
+#endif
         OCStackResult unsubscribePresence(OCPresenceHandle presenceHandle)
         {
             return OCPlatform_impl::Instance().unsubscribePresence(presenceHandle);
index 9d9ae52..e4eda8e 100644 (file)
@@ -138,6 +138,64 @@ namespace OC
                             static_cast<OCQualityOfService>(QoS)));
     }
 
+#ifdef CA_INT
+    OCResource::Ptr OCPlatform_impl::constructResourceObject(const std::string& host,
+                                                const std::string& uri, uint8_t connectivityType,
+                                                bool isObservable,
+                                                const std::vector<std::string>& resourceTypes,
+                                                const std::vector<std::string>& interfaces)
+    {
+        if(!m_client)
+        {
+            return std::shared_ptr<OCResource>();
+        }
+
+        return std::shared_ptr<OCResource>(new OCResource(m_client,
+                                            host,
+                                            uri, connectivityType,
+                                            isObservable,
+                                            resourceTypes,
+                                            interfaces));
+    }
+
+    OCStackResult OCPlatform_impl::findResource(const std::string& host,
+                                            const std::string& resourceName,
+                                            uint8_t connectivityType,
+                                            FindCallback resourceHandler)
+    {
+        return findResource(host, resourceName, connectivityType, resourceHandler, m_cfg.QoS);
+    }
+
+    OCStackResult OCPlatform_impl::findResource(const std::string& host,
+                                            const std::string& resourceName,
+                                            uint8_t connectivityType,
+                                            FindCallback resourceHandler, QualityOfService QoS)
+    {
+
+        return checked_guard(m_client, &IClientWrapper::ListenForResource,
+                             host, resourceName, connectivityType, resourceHandler, QoS);
+    }
+
+    OCStackResult OCPlatform_impl::getDeviceInfo(const std::string& host,
+                                            const std::string& deviceURI,
+                                            uint8_t connectivityType,
+                                            FindDeviceCallback deviceInfoHandler)
+    {
+        return result_guard(getDeviceInfo(host, deviceURI, connectivityType,
+               deviceInfoHandler, m_cfg.QoS));
+    }
+
+    OCStackResult OCPlatform_impl::getDeviceInfo(const std::string& host,
+                                            const std::string& deviceURI,
+                                            uint8_t connectivityType,
+                                            FindDeviceCallback deviceInfoHandler,
+                                            QualityOfService QoS)
+    {
+        return checked_guard(m_client, &IClientWrapper::ListenForDevice,
+                             host, deviceURI, connectivityType, deviceInfoHandler, QoS);
+    }
+
+#else
     OCResource::Ptr OCPlatform_impl::constructResourceObject(const std::string& host,
                                                 const std::string& uri,
                                                 bool isObservable,
@@ -168,6 +226,7 @@ namespace OC
                                             const std::string& resourceName,
                                             FindCallback resourceHandler, QualityOfService QoS)
     {
+
         return checked_guard(m_client, &IClientWrapper::ListenForResource,
                              host, resourceName, resourceHandler, QoS);
     }
@@ -188,6 +247,8 @@ namespace OC
                              host, deviceURI, deviceInfoHandler, QoS);
     }
 
+#endif
+
     OCStackResult OCPlatform_impl::registerResource(OCResourceHandle& resourceHandle,
                                             std::string& resourceURI,
                                             const std::string& resourceTypeName,
@@ -291,6 +352,26 @@ namespace OC
         return checked_guard(m_server, &IServerWrapper::stopPresence);
     }
 
+#ifdef CA_INT
+    OCStackResult OCPlatform_impl::subscribePresence(OCPresenceHandle& presenceHandle,
+                                            const std::string& host, uint8_t connectivityType,
+                                            SubscribeCallback presenceHandler)
+    {
+        return subscribePresence(presenceHandle, host, "", connectivityType, presenceHandler);
+    }
+
+
+    OCStackResult OCPlatform_impl::subscribePresence(OCPresenceHandle& presenceHandle,
+                                            const std::string& host,
+                                            const std::string& resourceType,
+                                            uint8_t connectivityType,
+                                            SubscribeCallback presenceHandler)
+    {
+        return checked_guard(m_client, &IClientWrapper::SubscribePresence,
+                             &presenceHandle, host, resourceType, connectivityType,
+                             presenceHandler);
+    }
+#else
     OCStackResult OCPlatform_impl::subscribePresence(OCPresenceHandle& presenceHandle,
                                             const std::string& host,
                                             SubscribeCallback presenceHandler)
@@ -304,8 +385,10 @@ namespace OC
                                             SubscribeCallback presenceHandler)
     {
         return checked_guard(m_client, &IClientWrapper::SubscribePresence,
-                             &presenceHandle, host, resourceType, presenceHandler);
+                             &presenceHandle, host, resourceType,
+                             presenceHandler);
     }
+#endif
 
     OCStackResult OCPlatform_impl::unsubscribePresence(OCPresenceHandle presenceHandle)
     {
index df5ff60..3581eee 100644 (file)
@@ -27,6 +27,29 @@ using OC::nil_guard;
 using OC::result_guard;
 using OC::checked_guard;
 
+#ifdef CA_INT
+OCResource::OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
+                       const std::string& uri, uint8_t connectivityType, bool observable,
+                       const std::vector<std::string>& resourceTypes,
+                       const std::vector<std::string>& interfaces)
+ :  m_clientWrapper(clientWrapper), m_uri(uri), m_connectivityType(connectivityType),
+    m_host(host), m_isObservable(observable),
+    m_isCollection(false), m_resourceTypes(resourceTypes), m_interfaces(interfaces),
+    m_observeHandle(nullptr)
+{
+    m_isCollection = std::find(m_interfaces.begin(), m_interfaces.end(), LINK_INTERFACE)
+                        != m_interfaces.end();
+
+    if (m_uri.empty() ||
+        resourceTypes.empty() ||
+        interfaces.empty()||
+        m_clientWrapper.expired())
+    {
+        throw ResourceInitException(m_uri.empty(), resourceTypes.empty(),
+                interfaces.empty(), m_clientWrapper.expired(), false, false);
+    }
+}
+#else
 OCResource::OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::string& host,
                        const std::string& uri, bool observable, const std::vector<std::string>& resourceTypes,
                        const std::vector<std::string>& interfaces)
@@ -46,6 +69,7 @@ OCResource::OCResource(std::weak_ptr<IClientWrapper> clientWrapper, const std::s
                 interfaces.empty(), m_clientWrapper.expired(), false, false);
     }
 }
+#endif
 
 OCResource::~OCResource()
 {
@@ -54,8 +78,14 @@ OCResource::~OCResource()
 OCStackResult OCResource::get(const QueryParamsMap& queryParametersMap,
                               GetCallback attributeHandler, QualityOfService QoS)
 {
+#ifdef CA_INT
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::GetResourceRepresentation,
+                         m_host, m_uri, m_connectivityType, queryParametersMap, m_headerOptions,
+                         attributeHandler, QoS);
+#else
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::GetResourceRepresentation,
                          m_host, m_uri, queryParametersMap, m_headerOptions, attributeHandler, QoS);
+#endif
 }
 
 OCStackResult OCResource::get(const QueryParamsMap& queryParametersMap,
@@ -98,8 +128,14 @@ OCStackResult OCResource::put(const OCRepresentation& rep,
                               const QueryParamsMap& queryParametersMap, PutCallback attributeHandler,
                               QualityOfService QoS)
 {
+#ifdef CA_INT
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PutResourceRepresentation,
+                         m_host, m_uri, m_connectivityType, rep, queryParametersMap,
+                         m_headerOptions, attributeHandler, QoS);
+#else
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PutResourceRepresentation,
                          m_host, m_uri, rep, queryParametersMap, m_headerOptions, attributeHandler, QoS);
+#endif
 }
 
 OCStackResult OCResource::put(const OCRepresentation& rep,
@@ -147,8 +183,14 @@ OCStackResult OCResource::post(const OCRepresentation& rep,
                                const QueryParamsMap& queryParametersMap, PostCallback attributeHandler,
                                QualityOfService QoS)
 {
+#ifdef CA_INT
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
+                         m_host, m_uri, m_connectivityType, rep, queryParametersMap,
+                         m_headerOptions, attributeHandler, QoS);
+#else
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
                          m_host, m_uri, rep, queryParametersMap, m_headerOptions, attributeHandler, QoS);
+#endif
 }
 
 OCStackResult OCResource::post(const OCRepresentation& rep,
@@ -194,8 +236,13 @@ OCStackResult OCResource::post(const std::string& resourceType,
 
 OCStackResult OCResource::deleteResource(DeleteCallback deleteHandler, QualityOfService QoS)
 {
+#ifdef CA_INT
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
+                         m_host, m_uri, m_connectivityType, m_headerOptions, deleteHandler, QoS);
+#else
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
                          m_host, m_uri, m_headerOptions, deleteHandler, QoS);
+#endif
 }
 
 OCStackResult OCResource::deleteResource(DeleteCallback deleteHandler)
@@ -215,9 +262,16 @@ OCStackResult OCResource::observe(ObserveType observeType,
         return result_guard(OC_STACK_INVALID_PARAM);
     }
 
+#ifdef CA_INT
+    return checked_guard(m_clientWrapper.lock(), &IClientWrapper::ObserveResource,
+                         observeType, &m_observeHandle, m_host,
+                         m_uri, m_connectivityType, queryParametersMap, m_headerOptions,
+                         observeHandler, QoS);
+#else
     return checked_guard(m_clientWrapper.lock(), &IClientWrapper::ObserveResource,
                          observeType, &m_observeHandle, m_host,
                          m_uri, queryParametersMap, m_headerOptions, observeHandler, QoS);
+#endif
 }
 
 OCStackResult OCResource::observe(ObserveType observeType,
@@ -265,6 +319,13 @@ std::string OCResource::uri() const
     return m_uri;
 }
 
+#ifdef CA_INT
+uint8_t OCResource::connectivityType() const
+{
+    return m_connectivityType;
+}
+#endif
+
 bool OCResource::isObservable() const
 {
     return m_isObservable;