Exposed APIs for getting resource types and resource interfaces in OCResource header...
authorSudarshan Prasad <sudarshan.prasad@intel.com>
Fri, 22 Aug 2014 00:14:01 +0000 (17:14 -0700)
committerSudarshan Prasad <sudarshan.prasad@intel.com>
Fri, 22 Aug 2014 00:19:17 +0000 (17:19 -0700)
Change-Id: Iac6ac0dc064c62c419c1dee186f05d5aeb064623

examples/simpleclient.cpp
examples/simpleclientserver.cpp
include/OCResource.h

index 2a4bc51..e552dad 100644 (file)
@@ -249,6 +249,20 @@ void foundResource(std::shared_ptr<OCResource> resource)
             hostAddress = resource->host();
             std::cout << "\tHost address of the resource: " << hostAddress << std::endl;
 
+            // Get the resource types 
+            std::cout << "\tList of resource types: " << std::endl;
+            for(auto &resourceTypes : resource->getResourceTypes())
+            {
+                std::cout << "\t\t" << resourceTypes << std::endl;
+            }
+            
+            // Get the resource interfaces
+            std::cout << "\tList of resource interfaces: " << std::endl;
+            for(auto &resourceInterfaces : resource->getResourceInterfaces())
+            {
+                std::cout << "\t\t" << resourceInterfaces << std::endl;
+            } 
+
             if(resourceURI == "/a/light")
             {
                 curResource = resource;
index dd5900f..23002ff 100644 (file)
@@ -131,6 +131,20 @@ private:
             std::cout << "Found Resource: "<<std::endl;
             std::cout << "\tHost: "<< resource->host()<<std::endl;
             std::cout << "\tURI:  "<< resource->uri()<<std::endl;
+            
+            // Get the resource types 
+            std::cout << "\tList of resource types: " << std::endl;
+            for(auto &resourceTypes : resource->getResourceTypes())
+            {
+                std::cout << "\t\t" << resourceTypes << std::endl;
+            }
+            
+            // Get the resource interfaces
+            std::cout << "\tList of resource interfaces: " << std::endl;
+            for(auto &resourceInterfaces : resource->getResourceInterfaces())
+            {
+                std::cout << "\t\t" << resourceInterfaces << std::endl;
+            } 
 
             std::cout<<"Doing a get on q/foo."<<std::endl;
             QueryParamsMap test;
index 2c65d55..2cb9479 100644 (file)
@@ -180,6 +180,24 @@ namespace OC
         */
         bool isObservable() const;
 
+        /**
+        * Function to get the list of resource types
+        * @return vector of resource types 
+        */
+        std::vector<std::string> getResourceTypes() const
+        {
+            return m_resourceTypes;
+        }
+        
+        /**
+        * Function to get the list of resource interfaces
+        * @return vector of resource interface
+        */
+        std::vector<std::string> getResourceInterfaces(void) const
+        {
+            return m_interfaces;
+        }
+
         // bool whether this is a collection type, and will have children that can be queried
         //bool isCollection() const {return m_isCollection;}
         // a collection of the resource-type names