Gave typedefs to every use of std::function in the C++ stack. Only existing use...
authorErich Keane <erich.keane@intel.com>
Fri, 5 Sep 2014 23:43:55 +0000 (16:43 -0700)
committerErich Keane <erich.keane@intel.com>
Mon, 8 Sep 2014 20:06:31 +0000 (13:06 -0700)
Patch 2: Sudarshan's review fixes
Change-Id: I8c62347c1091a2225d5db1b0bda5221a3346586e

14 files changed:
examples/simpleclientserver.cpp
include/IClientWrapper.h
include/IServerWrapper.h
include/InProcClientWrapper.h
include/InProcServerWrapper.h
include/OCApi.h
include/OCPlatform.h
include/OCResource.h
include/OutOfProcClientWrapper.h
include/OutOfProcServerWrapper.h
src/InProcClientWrapper.cpp
src/InProcServerWrapper.cpp
src/OCPlatform.cpp
src/OCResource.cpp

index 25e6d9a..a28fe6d 100644 (file)
@@ -109,7 +109,7 @@ private:
 
             rep2.setAttributeMap(attrMap2);
 
-            m_resource->put(rep2, QueryParamsMap(), std::function<void(const OCRepresentation, const int)>(std::bind(&ClientWorker::putResourceInfo, this, rep2, std::placeholders::_1, std::placeholders::_2)));
+            m_resource->put(rep2, QueryParamsMap(), PutCallback(std::bind(&ClientWorker::putResourceInfo, this, rep2, std::placeholders::_1, std::placeholders::_2)));
         }
     }
 
@@ -148,7 +148,7 @@ private:
 
             std::cout<<"Doing a get on q/foo."<<std::endl;
             QueryParamsMap test;
-            resource->get(test, std::function<void(const OCRepresentation, const int)>(std::bind(&ClientWorker::getResourceInfo, this, std::placeholders::_1, std::placeholders::_2)));
+            resource->get(test, GetCallback(std::bind(&ClientWorker::getResourceInfo, this, std::placeholders::_1, std::placeholders::_2)));
         } 
     }
 
@@ -156,7 +156,7 @@ public:
     void start(OCPlatform& platform)
     {
         std::cout<<"Starting Client find:"<<std::endl;
-        std::function<void(std::shared_ptr<OCResource>)> f (std::bind(&ClientWorker::foundResource, this, std::placeholders::_1));
+        FindCallback f (std::bind(&ClientWorker::foundResource, this, std::placeholders::_1));
         std::cout<<"result:" << platform.findResource("", "coap://224.0.1.187/oc/core?rt=core.foo", f)<< std::endl;
         std::cout<<"Finding Resource..."<<std::endl;
 
@@ -188,7 +188,7 @@ struct FooResource
 
         uint8_t resourceProperty = OC_DISCOVERABLE;
 
-        std::function<void(std::shared_ptr<OCResourceRequest>, std::shared_ptr<OCResourceResponse>)> eh(std::bind(&FooResource::entityHandler, this, std::placeholders::_1, std::placeholders::_2));
+        RegisterCallback eh(std::bind(&FooResource::entityHandler, this, std::placeholders::_1, std::placeholders::_2));
         OCStackResult result = platform.registerResource(m_resourceHandle, resourceURI, resourceTypeName,
                                     resourceInterface, 
                                     eh, resourceProperty);
index a486d8a..1adee61 100644 (file)
@@ -34,7 +34,7 @@ namespace OC
         typedef std::shared_ptr<IClientWrapper> Ptr;
 
         virtual OCStackResult ListenForResource(const std::string& serviceUrl, const std::string& resourceType,
-            std::function<void(std::shared_ptr<OCResource>)>& callback) = 0;
+            FindCallback& callback) = 0;
         
         virtual OCStackResult GetResourceAttributes(const std::string& host, const std::string& uri, const QueryParamsMap& queryParams, 
             GetCallback& callback)=0;
@@ -44,14 +44,14 @@ namespace OC
 
         virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle, 
             const std::string& host, const std::string& uri, const QueryParamsMap& queryParams, 
-            std::function<void(const OCRepresentation&, const int&, const int&)>& callback)=0;
+            ObserveCallback& callback)=0;
         
         virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host, const std::string& uri)=0;
         
-        virtual OCStackResult subscribePresence(OCDoHandle* handle, const std::string& host, 
-            std::function<void(OCStackResult, const int&)> presenceHandler)=0;
+        virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host, 
+            SubscribeCallback& presenceHandler)=0;
 
-        virtual OCStackResult unsubscribePresence(OCDoHandle handle) =0;
+        virtual OCStackResult UnsubscribePresence(OCDoHandle handle) =0;
 
         virtual ~IClientWrapper(){}
        
index 4126a17..fb6d710 100644 (file)
@@ -45,7 +45,7 @@ namespace OC
                     std::string& resourceURI,
                     const std::string& resourceTypeName,
                     const std::string& resourceInterface,
-                    std::function<void(const OCResourceRequest::Ptr, const OCResourceResponse::Ptr)> entityHandler,
+                    RegisterCallback& entityHandler,
                     uint8_t resourceProperty) = 0;
         virtual OCStackResult unregisterResource(
                     const OCResourceHandle& resourceHandle) = 0;
index 4ecc4a0..060ea6b 100644 (file)
@@ -44,7 +44,7 @@ namespace OC
         virtual ~InProcClientWrapper();
 
         virtual OCStackResult ListenForResource(const std::string& serviceUrl, const std::string& resourceType, 
-            std::function<void(std::shared_ptr<OCResource>)>& callback);
+            FindCallback& callback);
 
         virtual OCStackResult GetResourceAttributes(const std::string& host, const std::string& uri, const QueryParamsMap& queryParams, 
             GetCallback& callback);
@@ -54,14 +54,14 @@ namespace OC
 
         virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle, 
             const std::string& host, const std::string& uri, const QueryParamsMap& queryParams, 
-            std::function<void(const OCRepresentation&, const int&, const int&)>& callback);
+            ObserveCallback& callback);
 
         virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host, const std::string& uri);
 
-        virtual OCStackResult subscribePresence(OCDoHandle* handle, const std::string& host,
-            std::function<void(OCStackResult, const int&)> presenceHandler);
+        virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
+            SubscribeCallback& presenceHandler);
 
-        virtual OCStackResult unsubscribePresence(OCDoHandle handle);
+        virtual OCStackResult UnsubscribePresence(OCDoHandle handle);
         // Note: this should never be called by anyone but the handler for the listen command.  It is public becuase that needs to be a non-instance callback
         virtual std::shared_ptr<OCResource> parseOCResource(IClientWrapper::Ptr clientWrapper, const std::string& host, const boost::property_tree::ptree resourceNode);
     private:
@@ -71,7 +71,6 @@ namespace OC
         std::thread m_listeningThread;
         bool m_threadRun;
         std::weak_ptr<std::mutex> m_csdkLock;
-        std::vector<std::function<void(OCClientResponse*)>> callbackList;
 
     private:
         PlatformConfig m_cfg;
index f06c3db..450825f 100644 (file)
@@ -42,7 +42,7 @@ namespace OC
                     std::string& resourceURI,
                     const std::string& resourceTypeName,
                     const std::string& resourceInterface,
-                    std::function<void(const OCResourceRequest::Ptr, const OCResourceResponse::Ptr)> entityHandler,
+                    RegisterCallback& entityHandler,
                     uint8_t resourceProperty);
 
         virtual OCStackResult unregisterResource(
index 5f61c0e..3f6ae3a 100644 (file)
@@ -19,7 +19,7 @@
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 
 #ifndef __INTEL_OCAPI_H_2014_07_10
- #define __INTEL_OCAPI_H_2014_07_10
+#define __INTEL_OCAPI_H_2014_07_10
 
 #include <string>
 #include <sstream>
 #include <memory>
 #include "ocstack.h"
 
-namespace OC {
+namespace OC
+{
+    class OCResource;
+    class OCResourceRequest;
+    class OCResourceResponse;
+} // namespace OC
 
+namespace OC { namespace OCReflect {
+    struct entity;
+}} // namespace OC::OCReflect
 
-class OCResource;
+namespace OC
+{
+    enum class OCPlatformStatus
+    {
+        PlatformUp,
+        PlatformDown
+    };
 
-} // namespace OC
+    enum class OCAdvertisementStatus
+    {
+        None
+    };
 
-namespace OC { namespace OCReflect {
+    typedef std::string URI;
 
-struct entity;
+    enum class ServiceType
+    {
+        InProc,
+        OutOfProc
+    };
 
-}} // namespace OC::OCReflect
+    enum class ModeType
+    {
+        Server,
+        Client,
+        Both
+    };
+
+    enum class QualityOfService : uint8_t
+    {
+        Confirmable     = OC_CONFIRMABLE,
+        NonConfirmable  = OC_NON_CONFIRMABLE
+    };
 
-namespace OC {
-
- enum class OCPlatformStatus {
-    PlatformUp,
-    PlatformDown
- };
-
- enum class OCAdvertisementStatus{
-    None
- };
-
- typedef std::string URI;
-
- enum class ServiceType
- {
-     InProc,
-     OutOfProc
- };
-
- enum class ModeType
- {
-     Server,
-     Client,
-     Both
- };
-
- enum class QualityOfService : uint8_t
- {
-    Confirmable     = OC_CONFIRMABLE,
-    NonConfirmable  = OC_NON_CONFIRMABLE
- };
-
- struct PlatformConfig
- {
-    ServiceType                serviceType;   // This will indicate whether it is InProc or OutOfProc
-    ModeType                   mode;          // This will indicate whether we want to do server, client or both
-    std::string                ipAddress;     // This is the ipAddress of the server to connect to
-    uint16_t                   port;          // Port of the server
-
-    QualityOfService           QoS;
-
-    public:
-    PlatformConfig(const ServiceType serviceType_,
-                   const ModeType mode_,
-                   const std::string& ipAddress_,
-                   const uint16_t port_,
-                   const QualityOfService QoS_)
-     : serviceType(serviceType_),
-       mode(mode_),
-       ipAddress(ipAddress_),
-       port(port_),
-       QoS(QoS_)
-    {}
- };
-
- enum class RequestHandlerFlag
- {
-    InitFlag,
-    RequestFlag,
-    ObserverFlag
- };
-
- enum class ObserveType
- {
-     Observe,
-     ObserveAll
- };
-
- // TODO: To find the complete JSon data structure and modify map value type
- // Typedef for attribute values and attribute map. 
- typedef std::vector<std::string> AttributeValues;
- typedef std::map<std::string, AttributeValues> AttributeMap; 
-
- // Typedef for query parameter map
- typedef std::map<std::string, std::string> QueryParamsMap;
-
- // const strings for different interfaces
-
- // Default interface
- const std::string DEFAULT_INTERFACE = "oc.mi.def";
-
- // Used in discovering (GET) links to other resources of a collection.
- const std::string LINK_INTERFACE = "oc.mi.ll";
-
- // Used in GET, PUT, POST, DELETE methods on links to other resources of a collection.
- const std::string BATCH_INTERFACE = "oc.mi.b";
-
- // Helper function to escape character in a string.
- std::string escapeString(const std::string& value);
-
- class OCRepresentation
+    struct PlatformConfig
     {
+        ServiceType                serviceType;   // This will indicate whether it is InProc or OutOfProc
+        ModeType                   mode;          // This will indicate whether we want to do server, client or both
+        std::string                ipAddress;     // This is the ipAddress of the server to connect to
+        uint16_t                   port;          // Port of the server
+
+        QualityOfService           QoS;
+
+        public:
+            PlatformConfig(const ServiceType serviceType_,
+            const ModeType mode_,
+            const std::string& ipAddress_,
+            const uint16_t port_,
+            const QualityOfService QoS_)
+                : serviceType(serviceType_),
+                mode(mode_),
+                ipAddress(ipAddress_),
+                port(port_),
+                QoS(QoS_)
+        {}
+    };
+
+    enum class RequestHandlerFlag
+    {
+        InitFlag,
+        RequestFlag,
+        ObserverFlag
+    };
+
+    enum class ObserveType
+    {
+        Observe,
+        ObserveAll
+    };
+
+    // TODO: To find the complete JSon data structure and modify map value type
+    // Typedef for attribute values and attribute map.
+    typedef std::vector<std::string> AttributeValues;
+    typedef std::map<std::string, AttributeValues> AttributeMap;
+
+    // Typedef for query parameter map
+    typedef std::map<std::string, std::string> QueryParamsMap;
 
-    private:
+    // const strings for different interfaces
 
+    // Default interface
+    const std::string DEFAULT_INTERFACE = "oc.mi.def";
+
+    // Used in discovering (GET) links to other resources of a collection.
+    const std::string LINK_INTERFACE = "oc.mi.ll";
+
+    // Used in GET, PUT, POST, DELETE methods on links to other resources of a collection.
+    const std::string BATCH_INTERFACE = "oc.mi.b";
+
+    // Helper function to escape character in a string.
+    std::string escapeString(const std::string& value);
+
+    class OCRepresentation
+    {
+
+        private:
         std::string m_uri;
         AttributeMap m_attributeMap;
         std::vector<std::string> m_resourceTypes;
@@ -145,8 +144,7 @@ namespace OC {
 
         std::vector<OCRepresentation> m_children;
 
-    public:
-
+        public:
         OCRepresentation() {}
 
         std::string getUri(void) const
@@ -166,7 +164,7 @@ namespace OC {
 
         void setChildren(std::vector<OCRepresentation> children)
         {
-            m_children = children;
+        m_children = children;
         }
 
         OCResource* getResource() const
@@ -177,7 +175,7 @@ namespace OC {
             return res;
         }
 
-        AttributeMap getAttributeMap() const 
+        AttributeMap getAttributeMap() const
         {
             return m_attributeMap;
         }
@@ -207,8 +205,13 @@ namespace OC {
             m_resourceInterfaces = resourceInterfaces;
         }
     };
- typedef std::function<void(const OCRepresentation&, const int)> GetCallback;
- typedef std::function<void(const OCRepresentation&, const int)> PutCallback;
+
+    typedef std::function<void(std::shared_ptr<OCResource>)> FindCallback;
+    typedef std::function<void(const std::shared_ptr<OCResourceRequest>, const std::shared_ptr<OCResourceResponse>)> RegisterCallback;
+    typedef std::function<void(OCStackResult, const int)> SubscribeCallback;
+    typedef std::function<void(const OCRepresentation&, const int)> GetCallback;
+    typedef std::function<void(const OCRepresentation&, const int)> PutCallback;
+    typedef std::function<void(const OCRepresentation&, const int, const int)> ObserveCallback;
 } // namespace OC
 
-#endif  
+#endif
index 26ce6a6..b9209b0 100644 (file)
@@ -98,7 +98,7 @@ namespace OC
         * NOTE: OCStackResult is defined in ocstack.h.
         */
         OCStackResult findResource(const std::string& host, const std::string& resourceURI,
-            std::function<void(OCResource::Ptr)> resourceHandler);
+            FindCallback resourceHandler);
 
         /**
         * This API registers a resource with the server
@@ -128,7 +128,7 @@ namespace OC
                         std::string& resourceURI,
                         const std::string& resourceTypeName,
                         const std::string& resourceInterface,
-                        std::function<void(const OCResourceRequest::Ptr, const OCResourceResponse::Ptr)> entityHandler,
+                        RegisterCallback entityHandler,
                         uint8_t resourceProperty);
 
         /**
@@ -268,7 +268,7 @@ namespace OC
         * @return OCStackResult - return value of the API.  Returns OCSTACK_OK if success <br>
         */
         OCStackResult subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host, 
-                        std::function<void(OCStackResult, const int&)> presenceHandler);
+                        SubscribeCallback presenceHandler);
 
         /**
         * unsubscribes from a previously subscribed server's presence events. Note that
index 810dc4c..c224fd1 100644 (file)
@@ -145,7 +145,7 @@ namespace OC
         * NOTE: OCStackResult is defined in ocstack.h.
         */
         OCStackResult observe(ObserveType observeType, const QueryParamsMap& queryParametersMap, 
-            std::function<void(const OCRepresentation&, const int&, const int&)> observeHandler);
+            ObserveCallback observeHandler);
 
         /**
         * Function to cancel the observation on the resource
index a769f4b..2ff41fe 100644 (file)
@@ -31,7 +31,7 @@ namespace OC
         OutOfProcClientWrapper(std::weak_ptr<std::mutex> csdkLock, PlatformConfig cfg) { }
         
         virtual OCStackResult ListenForResource(const std::string& serviceUrl, const std::string& resourceType, 
-            std::function<void(std::shared_ptr<OCResource>)>& callback) {return OC_STACK_NOTIMPL;}
+            FindCallback& callback) {return OC_STACK_NOTIMPL;}
 
         virtual OCStackResult GetResourceAttributes(const std::string& host, const std::string& uri, 
             const QueryParamsMap& queryParams, GetCallback& callback){return OC_STACK_NOTIMPL;}
@@ -41,17 +41,17 @@ namespace OC
 
         virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle, const std::string& host, 
             const std::string& uri, const QueryParamsMap& queryParams, 
-            std::function<void(const OCRepresentation&, const int&, const int&)>& callback){return OC_STACK_NOTIMPL;}
+            ObserveCallback& callback){return OC_STACK_NOTIMPL;}
         
         virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host, const std::string& uri){return OC_STACK_NOTIMPL;}
 
         virtual std::shared_ptr<OCResource> parseOCResource(IClientWrapper::Ptr clientWrapper, const std::string& host, 
             const boost::property_tree::ptree resourceNode) {return nullptr;}
 
-        virtual OCStackResult subscribePresence(OCDoHandle* handle, const std::string& host,
-            std::function<void(OCStackResult, const int&)> presenceHandler){return OC_STACK_NOTIMPL;}
+        virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
+            SubscribeCallback& presenceHandler){return OC_STACK_NOTIMPL;}
 
-        virtual OCStackResult unsubscribePresence(OCDoHandle handle){return OC_STACK_NOTIMPL;}
+        virtual OCStackResult UnsubscribePresence(OCDoHandle handle){return OC_STACK_NOTIMPL;}
     };
 }
 
index 2503ee5..e276d12 100644 (file)
@@ -35,7 +35,7 @@ namespace OC
                     std::string& resourceURI,
                     const std::string& resourceTypeName,
                     const std::string& resourceInterface,
-                    std::function<void(const OCResourceRequest::Ptr, const OCResourceResponse::Ptr)> entityHandler,
+                    RegisterCallback& entityHandler,
                     uint8_t resourceProperty)
 
         {
index 5393291..6c375a4 100644 (file)
@@ -108,7 +108,7 @@ namespace OC
 
     struct ListenContext
     {
-        std::function<void(std::shared_ptr<OCResource>)> callback;
+        FindCallback callback;
         IClientWrapper::Ptr clientWrapper;
     };
 
@@ -202,7 +202,7 @@ namespace OC
         }
     } 
 
-    OCStackResult InProcClientWrapper::ListenForResource(const std::string& serviceUrl, const std::string& resourceType, std::function<void (std::shared_ptr<OCResource>)>& callback)
+    OCStackResult InProcClientWrapper::ListenForResource(const std::string& serviceUrl, const std::string& resourceType, FindCallback& callback)
     {
         OCStackResult result;
 
@@ -501,7 +501,7 @@ namespace OC
 
     struct ObserveContext
     {
-        std::function<void(const OCRepresentation&, const int&, const int&)> callback;
+        ObserveCallback callback;
     };
 
     OCStackApplicationResult observeResourceCallback(void* ctx, OCDoHandle handle, OCClientResponse* clientResponse)
@@ -519,7 +519,7 @@ namespace OC
     }
 
     OCStackResult InProcClientWrapper::ObserveResource(ObserveType observeType, OCDoHandle* handle, const std::string& host, 
-       const std::string& uri, const QueryParamsMap& queryParams, std::function<void(const OCRepresentation&, const int&, const int&)>& callback)
+       const std::string& uri, const QueryParamsMap& queryParams, ObserveCallback& callback)
     {
         OCStackResult result;
         OCCallbackData* cbdata = new OCCallbackData();
@@ -566,19 +566,6 @@ namespace OC
         return result;
     }
 
-    struct UnobserveContext
-    {
-        std::function<void(const int&)> callback;
-    };
-
-    OCStackApplicationResult unobserveResourceCallback(void* ctx, OCDoHandle handle, OCClientResponse* clientResponse)
-    {
-        UnobserveContext* context = static_cast<UnobserveContext*>(ctx);
-        std::thread exec(context->callback, clientResponse->result);
-        exec.detach();
-        return OC_STACK_DELETE_TRANSACTION;
-    }
-
     OCStackResult InProcClientWrapper::CancelObserveResource(OCDoHandle handle, const std::string& host, const std::string& uri)
     {
         OCStackResult result;
@@ -599,7 +586,7 @@ namespace OC
 
     struct SubscribePresenceContext
     {
-        std::function<void(OCStackResult, const int&)> callback;
+        SubscribeCallback callback;
     };
 
     OCStackApplicationResult subscribePresenceCallback(void* ctx, OCDoHandle handle, OCClientResponse* clientResponse)
@@ -611,8 +598,8 @@ namespace OC
         return OC_STACK_KEEP_TRANSACTION;
     }
 
-    OCStackResult InProcClientWrapper::subscribePresence(OCDoHandle* handle, const std::string& host,
-                std::function<void(OCStackResult, const int&)> presenceHandler)
+    OCStackResult InProcClientWrapper::SubscribePresence(OCDoHandle* handle, const std::string& host,
+                SubscribeCallback& presenceHandler)
     {
         OCStackResult result;
         OCCallbackData* cbdata = new OCCallbackData();
@@ -640,7 +627,7 @@ namespace OC
         return result;
     }
 
-    OCStackResult InProcClientWrapper::unsubscribePresence(OCDoHandle handle)
+    OCStackResult InProcClientWrapper::UnsubscribePresence(OCDoHandle handle)
     {
         OCStackResult result;
         auto cLock = m_csdkLock.lock();
index 0be188c..7721543 100644 (file)
@@ -41,7 +41,7 @@ using namespace OC::OCReflect;
 
 using namespace std;
 
-std::map <OCResourceHandle, std::function<void(const OC::OCResourceRequest::Ptr, const OC::OCResourceResponse::Ptr)>> entityHandlerMap;
+std::map <OCResourceHandle, OC::RegisterCallback>  entityHandlerMap;
 
 void defaultEntityHandler(const OC::OCResourceRequest::Ptr request, const OC::OCResourceResponse::Ptr response)
 {
@@ -214,7 +214,7 @@ namespace OC
                     std::string& resourceURI,
                     const std::string& resourceTypeName,
                     const std::string& resourceInterface,
-                    std::function<void(const OCResourceRequest::Ptr, const OCResourceResponse::Ptr)> eHandler,
+                    RegisterCallback& eHandler,
                     uint8_t resourceProperties)
 
     {
index dbf5a14..c312a01 100644 (file)
@@ -78,8 +78,8 @@ namespace OC
     }
 
     OCResource::Ptr OCPlatform::constructResourceObject(const std::string& host, const std::string& uri,
-                bool isObservable, const std::vector<std::string>& resourceTypes,
-                const std::vector<std::string>& interfaces)
+        bool isObservable, const std::vector<std::string>& resourceTypes,
+        const std::vector<std::string>& interfaces)
     {
         if(m_client)
         {
@@ -93,7 +93,7 @@ namespace OC
     }
 
     OCStackResult OCPlatform::findResource(const std::string& host, const std::string& resourceName,
-                std::function<void(OCResource::Ptr)> resourceHandler)
+        FindCallback resourceHandler)
     {
         if(m_client)
         {
@@ -104,11 +104,11 @@ namespace OC
 
 
     OCStackResult OCPlatform::registerResource(OCResourceHandle& resourceHandle,
-                std::string& resourceURI,
-                const std::string& resourceTypeName,
-                const std::string& resourceInterface,
-                std::function<void(const OCResourceRequest::Ptr, const OCResourceResponse::Ptr)> entityHandler,
-                uint8_t resourceProperty)
+        std::string& resourceURI,
+        const std::string& resourceTypeName,
+        const std::string& resourceInterface,
+        RegisterCallback entityHandler,
+        uint8_t resourceProperty)
     {
         OCStackResult result = OC_STACK_OK;
 
@@ -225,7 +225,7 @@ namespace OC
     }
 
     OCStackResult OCPlatform::bindTypeToResource(const OCResourceHandle& resourceHandle,
-                     const std::string& resourceTypeName) const
+        const std::string& resourceTypeName) const
     {
         OCStackResult result = OC_STACK_ERROR;
         if(m_server)
@@ -245,7 +245,7 @@ namespace OC
     }
 
     OCStackResult OCPlatform::bindInterfaceToResource(const OCResourceHandle& resourceHandle,
-                     const std::string& resourceInterfaceName) const
+        const std::string& resourceInterfaceName) const
     {
         OCStackResult result = OC_STACK_ERROR;
         if(m_server)
@@ -290,11 +290,11 @@ namespace OC
     }
 
     OCStackResult OCPlatform::subscribePresence(OCPresenceHandle& presenceHandle, const std::string& host, 
-                    std::function<void(OCStackResult, const int&)> presenceHandler)
+        SubscribeCallback presenceHandler)
     {
         if(m_client)
         {
-            return m_client->subscribePresence(&presenceHandle, host, presenceHandler);
+            return m_client->SubscribePresence(&presenceHandle, host, presenceHandler);
         }
         else
         {
@@ -306,7 +306,7 @@ namespace OC
     {
         if(m_client)
         {
-            return m_client->unsubscribePresence(presenceHandle);
+            return m_client->UnsubscribePresence(presenceHandle);
         }
         else
         {
index 3c841f0..564965f 100644 (file)
@@ -120,7 +120,7 @@ namespace OC {
     }
 
     OCStackResult OCResource::observe(ObserveType observeType, const QueryParamsMap& queryParametersMap, 
-        std::function<void(const OCRepresentation&, const int&, const int&)> observeHandler)
+        ObserveCallback observeHandler)
     {
         if(m_observeHandle != nullptr)
         {