replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / resource-encapsulation / include / RCSRemoteResourceObject.h
index c080804..e5af9a2 100644 (file)
 /**
  * @file
  *
- * This file contains the Resource Client APIs provided to the developers.
- * It is a common API layer for the Resource Broker and Resource Cache module of Resource
- * Manipulation layer.
+ * This file contains the declaration of classes and its members related to RCSRemoteResourceObject
  */
 
-#ifndef RCS_RemoteResourceObject_H
-#define RCS_RemoteResourceObject_H
+#ifndef RCSREMOTERESOURCEOBJECT_H
+#define RCSREMOTERESOURCEOBJECT_H
+
+#include <vector>
 
-#include<vector>
 #include "RCSResourceAttributes.h"
+#include "RCSRepresentation.h"
+
+namespace OC
+{
+    class OCResource;
+
+    namespace HeaderOption
+    {
+        class OCHeaderOption;
+    }
+}
 
 namespace OIC
 {
     namespace Service
     {
+
+        class RCSRepresentation;
+
+        typedef std::vector< OC::HeaderOption::OCHeaderOption > HeaderOpts;
+
         /**
-        * Cache State enum specify the state of the Cache.
-        */
+         * The states of caching.
+         *
+         * @see startCaching
+         * @see getCacheState
+         */
         enum class CacheState
         {
-            READY = 0,
-            READY_YET,
-            LOST_SIGNAL,
-            DESTROYED,
-            UPDATING,
-            NONE
+            NONE, /**< Caching is not started.*/
+            UNREADY, /**< Caching is started, but the data is not ready yet.
+                          This is the default state after startCaching. */
+            READY, /**< The data is ready.*/
+            LOST_SIGNAL, /**< Failed to reach the resource. */
         };
 
-        /**
-        * Resource State enum specify the state of the resource.
-        */
-        enum class ResourceState
+        enum class CacheMode
         {
-            NOT_MONITORING,
-            ALIVE, REQUESTED,
-            LOST_SIGNAL,
-            DESTROYED
+            OBSERVE_ONLY,
+            OBSERVE_WITH_POLLING
         };
 
-        /*
-        * Forward Declaration of Classes
-        */
-        class RCSException;
-        class RCSRemoteResourceObject;
-        class PrimitiveResource;
-
         /**
-         * @class  BadRequestException
-         * @brief  This class is used to throw exception to the upper layer if request is invalid.
-         *             It is inherited from RCSException class.
+         * The states of monitoring.
          *
+         * @see startMonitoring
+         * @see getState
          */
-        class BadRequestException: public RCSException
+        enum class ResourceState
         {
-            public:
-                BadRequestException(const std::string &what) : RCSException { what } {}
-                BadRequestException(std::string &&what) : RCSException { std::move(what) } {}
+            NONE, /**< Monitoring is not started.*/
+            REQUESTED, /**< Monitoring is started and checking state is in progress.
+                            This is the default state after startMonitoring. */
+            ALIVE, /**< The resource is alive. */
+            LOST_SIGNAL, /**< Failed to reach the resource. */
+            DESTROYED /**< The resource is deleted. */
         };
 
+        class PrimitiveResource;
+
         /**
-         * @class   InvalidParameterException
-         * @brief   This class is used to throw exception to the upper layer if parameter is invalid.
-         *              It is  inherited from RCSException class.
+         * This is to specify query parameters for requests to the server.
+         *
+         * @see RCSRemoteResourceObject
          */
-        class InvalidParameterException: public RCSException
+        class RCSQueryParams
         {
-            public:
-                InvalidParameterException(const std::string &what) : RCSException { what } {}
-                InvalidParameterException(std::string &&what) : RCSException { std::move(what) } {}
+        public:
+            typedef std::unordered_map< std::string, std::string > Map;
+
+        public:
+
+            /**
+             * Sets an interface of the resource to operate on
+             *
+             * @param interface interface
+             */
+            RCSQueryParams& setResourceInterface(std::string interface);
+
+            /**
+             * Sets a resource type of the resource to operate on
+             *
+             * @param type resource type
+             */
+            RCSQueryParams& setResourceType(std::string type);
+
+            /**
+             * Sets a resource type of the resource to operate on
+             *
+             * @param key key to be inserted
+             * @param value value to be inserted
+             *
+             * @note "rt" and "if" are reserved, so you should avoid them as a key.
+             *
+             */
+            RCSQueryParams& put(std::string key, std::string value);
+
+            /**
+             * Returns the resource interface.
+             */
+            std::string getResourceInterface() const;
+
+            /**
+             * Returns the resource type.
+             */
+            std::string getResourceType() const;
+
+            /**
+             * Returns a value.
+             *
+             * @param key key of the element whose mapped value is accessed.
+             *
+             * @throws InvalidKeyException If @a key doesn't match the key of any value.
+             */
+            std::string get(const std::string& key) const;
+
+            /**
+             * Returns all params.
+             */
+            const Map& getAll() const;
+
+        private:
+            std::string m_resourceInterface;
+            std::string m_resourceType;
+
+            std::unordered_map< std::string, std::string > m_map;
         };
 
         /**
-         * @class   RCSRemoteResourceObject
-         * @brief   This class is an interaction point between Resource
-         *              and the developers. Developer will get the RCSRemoteResourceObject by calling the
-         *              discoverResource() API of "RCSDiscoveryManager" class.
          *
-         * @see DiscoveryManager
+         * This represents a remote resource and provides simple ways to interact with it.
+         * Basically this is a client of a remote resource that runs on other device.
+         *
+         * The class supports features to help get information of a remote resource
+         * such as monitoring and caching.
+         *
+         * @see RCSDiscoveryManager
          *
          */
-        class RCSRemoteResourceObject
+        class RCSRemoteResourceObject : public std::enable_shared_from_this<RCSRemoteResourceObject>
         {
-            public:
-
-                /**
-                 * Constructor for RCSRemoteResourceObject
-                */
-                RCSRemoteResourceObject(std::shared_ptr<PrimitiveResource>  pResource);
-
-                /**
-                 *  Typedef for callback of startMonitoring API
-                 *
-                 * @see ResourceState
-                 */
-                typedef std::function< void(ResourceState) > ResourceStateChangedCallback;
-
-                /**
-                *  Typedef for callback of startCaching API
-                *
-                * @see RCSResourceAttributes
-                */
-                typedef std::function< void(const RCSResourceAttributes &) > CacheUpdatedCallback;
-
-                /**
-                *  Typedef for callback of getRemoteAttributes API
-                *
-                *  @see RCSResourceAttributes
-                */
-                typedef std::function< void(const RCSResourceAttributes &) >
-                RemoteAttributesReceivedCallback;
-
-
-                /**
-                *  Typedef for callback of setRemoteAttributes API
-                *
-                *  @see RCSResourceAttributes
-                */
-                typedef std::function< void(const RCSResourceAttributes &) >
+        public:
+            typedef std::shared_ptr< RCSRemoteResourceObject > Ptr;
+
+            /**
+             * Callback definition to be invoked when monitoring state is changed.
+             *
+             * @see startMonitioring
+             * @see ResourceState
+             */
+            typedef std::function< void(ResourceState) > StateChangedCallback;
+
+            /**
+             * Callback definition to be invoked when cache is updated.
+             *
+             * @param attrs the updated attributes
+             */
+            typedef std::function< void(const RCSResourceAttributes& attrs, int eCode) >
+                CacheUpdatedCallback;
+
+            /**
+             * Callback definition to be invoked when the response of getRemoteAttributes is
+             * received.
+             *
+             * @param attrs the result attributes
+             * @param eCode the error code received from the resource
+             *
+             * @see getRemoteAttributes
+             */
+            typedef std::function< void(const RCSResourceAttributes& attrs, int eCode) >
+                RemoteAttributesGetCallback;
+
+            /**
+             * Callback definition to be invoked when the response of get is received.
+             *
+             * @param HeaderOpts
+             * @param rep the result representation
+             * @param eCode the error code received from the resource
+             *
+             * @see get
+             */
+            typedef std::function< void(const HeaderOpts& headerOpts,
+                    const RCSRepresentation& rep, int eCode) > GetCallback;
+
+            /**
+             * Callback definition to be invoked when the response of setRemoteAttributes is
+             * received.
+             *
+             * @param attrs the result attributes
+             * @param eCode the error code received from the resource
+             *
+             * @see setRemoteAttributes
+             */
+            typedef std::function< void(const RCSResourceAttributes& attrs, int eCode) >
                 RemoteAttributesSetCallback;
 
-                /**
-                 * Check monitoring state.
-                 *
-                 * @details This API checks the current monitoring state for the resource of interest.
-                 *
-                 * @return bool - true if monitoring the resource otherwise false.
-                 */
-                bool isMonitoring() const;
-
-                /**
-                 * Check current Caching state.
-                 *
-                 * @details This API checks the current caching state for the resource of interest.
-                 *
-                 * @return bool - true if Caching started otherwise false.
-                 */
-
-                bool isCaching() const;
-
-                /**
-                 * Check whether reosurce is observable or not.
-                 *
-                 * @details This API checks  the observable property of the resource.
-                 *
-                 * @return bool - true if observable otherwise false.
-                 */
-                bool isObservable() const;
-
-                /**
-                 * Start Monitoring the resource.
-                 *
-                 * @details This API will start monitoring the resource of interest.
-                 *               Once this API is called it will check whether the particular resource
-                 *               is available or not. It will provide the changed resource state in the callback.
-                 *
-                 * @param cb - callback to get changed resource state.
-                 *
-                 * @throw InvalidParameterException
-                 *
-                 * @see ResourceStateChangedCallback
-                 * @see ResourceState
-                 *
-                 * NOTE: Developer can call this API any number of time. Developer should take care
-                 *            of Synchronization as ResourceStateChangedCallback is asynchronous.
-                 *            This function throws the InvalidParameterException if the callback is NULL or not valid.
-                 */
-                void startMonitoring(ResourceStateChangedCallback cb);
-
-                /**
-                 * Stop monitoring the resource.
-                 *
-                 * @details This API will stop monitoring the resource of interest it means it will stop to look
-                 *               for the resource presence in the network.
-                 *
-                 * NOTE: If startMonitoring() is not being called & directly this API is called it will do nothing.
-                 *           Developer can call this API any number of time. It will not results in any kind of warning.
-                 *
-                 */
-                void stopMonitoring();
-
-                /**
-                 * Provides the current resource state. Resource state is an enum class.
-                 *
-                 * @return ResourceState - current state of the resource.
-                 *
-                 * @throw BadRequestException
-                 *
-                 * @see ResourceState
-                 */
-                ResourceState getState() const ;
-
-                /**
-                 * Start caching data for the resource of interest.
-                 *
-                 * @details This API will start data caching for the resource of interest.
-                 *               Once caching started it will look for the data updation on the resource of interest
-                 *                & updates the cache data accordingly. It provides the cached data on demand.
-                 *
-                 * @see getCachedAttributes()
-                 * @see getCachedAttribute( const std::string &)
-                 *
-                 * NOTE: developer can get the cached data by calling getCachedAttributes()
-                 *            or getCachedAttribute() API
-                 */
-                void startCaching();
-
-                /**
-                 * Start caching data for the resource of interest.
-                 *
-                 * @details This API will start data caching for the resource of interest.
-                 *              Once caching started it look for the data updation on the resource of interest &
-                 *              updates the cached data accordingly Whenever data is updated in the cache, it
-                 *              provides the updated data to the application/caller.
-                 *
-                 * @param cb - callback to get updated resourceAttributes.
-                 *
-                 * @throw InvalidParameterException
-                 *
-                 * @see CacheUpdatedCallback
-                 *
-                 * NOTE: Developer can call this API any number of time. Developer should
-                 *           take care of Synchronization as CacheUpdatedCallback is asynchronous.
-                 *           This function throws the InvalidParameterException if the callback is NULL or not valid.
-                 *
-                 */
-                void startCaching(CacheUpdatedCallback cb);
-
-                /**
-                 * Provides the current cache state for the resource of interest. CacheState is the enum class.
-                 *
-                 * @return CacheState - Current state of the Cache.
-                 *
-                 * @throw BadRequestException
-                 *
-                 * @see CacheState
-                 *
-                 */
-                CacheState getResourceCacheState();
-
-                /**
-                * Stop data caching for the resource of interest.
-                *
-                * @details This API will stop caching the data for the resource of interest.
-                *
-                * NOTE: If startCaching() or startCaching(CacheUpdatedCallback) is not being called &
-                *            directly this API is called it will do nothing.
-                *            Developer can call this API any number of time, it will not results in any warning.
-                *
-                */
-                void stopCaching();
-
-                /**
-                * Refresh the cache.
-                *
-                * @details This API will refresh the cache, i.e. it will get the latest data from the server.
-                *
-                */
-                void refreshCache() ;
-
-                /**
-                 * Get the cached RCSResourceAttributes data.
-                 *
-                 * @pre startCaching() or startCaching(CacheUpdatedCallback) API should be called.
-                 *
-                 * @return RCSResourceAttributes - cached resourceAttribute
-                 *
-                 * @throw BadRequestException
-                 *
-                 * @see startCaching()
-                 * @see startCaching(CacheUpdatedCallback)
-                 * @see RCSResourceAttributes
-                 *
-                 * NOTE: If startCaching() or startCaching(CacheUpdatedCallback) is not being called &
-                 *           directly this API is called it will throw the
-                 *           BadRequestException.
-                 */
-                RCSResourceAttributes getCachedAttributes() const;
-
-                /**
-                * Get a particular cached ResourceAttribute value.
-                *
-                * @pre startCaching() or startCaching(CacheUpdatedCallback) API should be called.
-                *
-                * @return RCSResourceAttributes::Value - requested attribute Value
-                *
-                * @throw BadRequestException
-                *
-                * @see startCaching()
-                * @see startCaching(CacheUpdatedCallback)
-                * @see RCSResourceAttributes::Value
-                *
-                * NOTE: If startCaching() or startCaching(CacheUpdatedCallback) is not being called &
-                *           directly this API is called it will throw the BadRequestException.
-                *
-                */
-                RCSResourceAttributes::Value getCachedAttribute( const std::string &) ;
-
-                /**
-                * Get resource attributes.
-                *
-                * @details This API send a get request to the resource of interest and provides the attributes
-                *               to the caller in the RemoteAttributesReceivedCallback.
-                *
-                *
-                * @throw InvalidParameterException
-                *
-                * @see RCSResourceAttributes::Value
-                */
-                void getRemoteAttributes(RemoteAttributesReceivedCallback cb);
-
-                /**
-                * Set resource attributes.
-                *
-                * @details This API send a set request to the resource of interest and provides the updated
-                *              attributes to the caller in the RemoteAttributesSetCallback.
-                *
-                * @param attributes - resourceAttributes data to set
-                * @param cb - callback on setting resourceAttributes data.
-                *
-                * @throw InvalidParameterException
-                *
-                */
-                void setRemoteAttributes(const RCSResourceAttributes &attributes, RemoteAttributesSetCallback cb);
-
-                /**
-                 * Get resource uri.
-                 *
-                 * @return string - uri of the Resource
-                 */
-                std::string getUri() const;
-
-                /**
-                 * Get resource address.
-                 *
-                 * @return string - address of the Resource
-                 */
-                std::string getAddress() const;
-
-                /**
-                 * Get resource types.
-                 *
-                 * @return vector - resource types
-                 */
-                std::vector< std::string > getTypes() const;
-
-                /**
-                 * Get resource interfaces.
-                 *
-                 * @return vector - resource interfaces
-                 */
-                std::vector< std::string > getInterfaces() const;
-
-            private:
-
-                /**
-                 *  Typedef for Cache ID
-                 */
-                typedef int CacheID;
-
-                /**
-                 *  Typedef for Broker ID
-                 */
-                typedef unsigned int BrokerID;
-
-                /**
-                 *  Flag to check monitoring state.
-                 */
-                bool m_monitoringFlag;
-
-                /**
-                 *  Flag to check caching state.
-                 */
-                bool m_cachingFlag;
-
-                /**
-                 *  Flag to check observing state.
-                 */
-                bool m_observableFlag;
-
-                /**
-                 *  PrimitiveResource
-                 */
-                std::shared_ptr<PrimitiveResource> m_primitiveResource;
-
-                /**
-                 *  caching identification number.
-                 */
-                CacheID m_cacheId;
-
-                /**
-                *  Broker  identification number.
-                */
-                BrokerID m_brokerId;
+            /**
+             * Callback definition to be invoked when the response of set is received.
+             *
+             * @param HeaderOpts
+             * @param rep the result representation
+             * @param eCode the error code received from the resource
+             *
+             * @see set
+             */
+            typedef std::function< void(const HeaderOpts& headerOpts,
+                    const RCSRepresentation& rep, int eCode) > SetCallback;
+
+        private:
+            typedef int CacheID;
+            typedef unsigned int BrokerID;
+
+        public:
+            //! @cond
+            RCSRemoteResourceObject(std::shared_ptr< PrimitiveResource >);
+            //! @endcond
+
+            ~RCSRemoteResourceObject();
+
+            /**
+             * Creates an instance from an OCResource instance.
+             *
+             * @throw RCSInvalidParameterException If ocResource is nullptr.
+             */
+            static RCSRemoteResourceObject::Ptr fromOCResource(
+                    std::shared_ptr< OC::OCResource > ocResource);
+
+            /**
+             * Returns an equivalent OCResource using RCSRemoteResourceObject instance.
+             *
+             * @throw RCSInvalidParameterException If rcsResource is nullptr.
+             */
+            static std::shared_ptr< OC::OCResource > toOCResource(
+                    RCSRemoteResourceObject::Ptr rcsResource);
+
+            /**
+             * Returns whether monitoring is enabled.
+             *
+             * @see startMonitoring()
+             */
+            bool isMonitoring() const;
+
+            /**
+             * Returns whether caching is enabled.
+             *
+             * @see startCaching()
+             */
+
+            bool isCaching() const;
+
+            /**
+             * Returns whether the resource is observable.
+             *
+             */
+            bool isObservable() const;
+
+            /**
+             * Starts monitoring the resource.
+             *
+             * Monitoring provides a feature to check the presence of a resource,
+             * even when the server is not announcing Presence using startPresnece.
+             *
+             * @param cb A Callback to get changed resource state.
+             *
+             * @throws InvalidParameterException If cb is an empty function or null.
+             * @throws BadRequestException If monitoring is already started.
+             *
+             * @note The callback will be invoked in an internal thread.
+             *
+             * @see StateChangedCallback
+             * @see ResourceState
+             * @see isMonitoring()
+             * @see stopMonitoring()
+             *
+             */
+            void startMonitoring(StateChangedCallback cb);
+
+            /**
+             * Stops monitoring the resource.
+             *
+             * It does nothing if monitoring is not started.
+             *
+             * @see startMonitoring()
+             *
+             */
+            void stopMonitoring();
+
+            /**
+             * Returns the current state of the resource.
+             *
+             * @see startMonitoring
+             */
+            ResourceState getState() const;
+
+            /**
+             * Starts caching attributes of the resource.
+             *
+             * This will start caching for the resource.
+             * Once caching started it will look for the data updation on the resource
+             * and updates the cache data accordingly.
+             *
+             * It is equivalent to calling startCaching(CacheUpdatedCallback) with an empty function.
+             *
+             * @see getCacheState()
+             * @see getCachedAttributes()
+             * @see getCachedAttribute(const std::string&) const
+             *
+             * @throws BadRequestException
+             *
+             */
+            void startCaching();
+
+            /**
+             * Starts caching attributes for the resource.
+             *
+             * This will start data caching for the resource.
+             * Once caching started it will look for the data updation on the resource and
+             * updates the cached data accordingly.
+             *
+             * @param cb If non-empty function, it will be invoked whenever the cache updated.
+             * @param mode if CacheMode is OBSERVE_ONLY, it will be invoked when receive observe response only.
+             *
+             * @throws BadRequestException If caching is already started.
+             *
+             * @note The callback will be invoked in an internal thread.
+             *
+             * @see CacheUpdatedCallback
+             * @see getCacheState()
+             * @see isCachedAvailable()
+             * @see getCachedAttributes()
+             * @see getCachedAttribute(const std::string&) const
+             *
+             */
+            void startCaching(CacheUpdatedCallback cb, CacheMode mode = CacheMode::OBSERVE_WITH_POLLING);
+
+            /**
+             * Stops caching.
+             *
+             * It does nothing if caching is not started.
+             *
+             * @see startCaching()
+             * @see startCaching(CacheUpdatedCallback)
+             */
+            void stopCaching();
+
+            /**
+             * Returns the current cache state.
+             *
+             */
+            CacheState getCacheState() const;
+
+            /**
+             * Returns whether cached data is available.
+             *
+             * Cache will be available always once cache state had been CacheState::READY
+             * even if current state is CacheState::LOST_SIGNAL.
+             *
+             * @see getCacheState()
+             */
+            bool isCachedAvailable() const;
+
+            /**
+             * Gets the cached RCSResourceAttributes data.
+             *
+             * @pre Cache should be available.
+             *
+             * @return The cached attributes.
+             *
+             * @throws BadRequestException If the precondition is not fulfilled.
+             *
+             * @see RCSResourceAttributes
+             * @see isCachedAvailable()
+             * @see startCaching()
+             * @see startCaching(CacheUpdatedCallback)
+             *
+             */
+            RCSResourceAttributes getCachedAttributes() const;
+
+            /**
+             * Gets a particular cached a ResourceAttribute Value.
+             *
+             * @pre Cache should be available.
+             *
+             * @return A requested attribute value.
+             *
+             * @throws BadRequestException If the precondition is not fulfilled.
+             * @throws InvalidKeyException If @a key doesn't match the key of any value.
+             *
+             * @see RCSResourceAttributes::Value
+             * @see isCachedAvailable()
+             * @see startCaching()
+             * @see startCaching(CacheUpdatedCallback)
+             *
+             */
+            RCSResourceAttributes::Value getCachedAttribute(const std::string& key) const;
+
+            /**
+             * Gets resource attributes directly from the server.
+             *
+             * This API send a get request to the resource of interest and provides
+             * the attributes to the caller in the RemoteAttributesGetCallback.
+             *
+             * @throws PlatformException If the operation failed
+             * @throws InvalidParameterException If cb is an empty function or null.
+             *
+             * @note The callback will be invoked in an internal thread.
+             */
+            void getRemoteAttributes(RemoteAttributesGetCallback cb);
+
+            /**
+             * Gets resource representation with empty query parameters directly from the server.
+             *
+             * @param cb A callback to receive the response.
+             *
+             * @throws PlatformException If the operation failed
+             * @throws InvalidParameterException If cb is an empty function or null.
+             *
+             * @note The callback will be invoked in an internal thread.
+             */
+            void get(GetCallback cb);
+
+            /**
+             * Gets resource representation directly from the server.
+             *
+             * The response could be different by the query parameters, it depends on server.
+             *
+             * @param queryParams Query parameters
+             * @param cb A callback to receive the response.
+             *
+             * @throws PlatformException If the operation failed
+             * @throws InvalidParameterException If cb is an empty function or null.
+             *
+             * @note The callback will be invoked in an internal thread.
+             */
+            void get(const RCSQueryParams& queryParams, GetCallback cb);
+
+            /**
+             * Sends a set request with resource attributes to the server.
+             *
+             * The SetRequest behavior depends on the server, whether updating its attributes or not.
+             *
+             * @param attributes Attributes to set
+             * @param cb A callback to receive the response.
+             *
+             * @throws PlatformException If the operation failed
+             * @throws InvalidParameterException If cb is an empty function or null.
+             *
+             * @see RCSResourceObject
+             * @see RCSResourceObject::SetRequestHandlerPolicy
+             *
+             * @note The callback will be invoked in an internal thread.
+             */
+            void setRemoteAttributes(const RCSResourceAttributes& attributes,
+                    RemoteAttributesSetCallback cb);
+
+            /**
+             * Sends a set request with resource attributes to the server.
+             *
+             * The SetRequest behavior depends on query parameters and the server.
+             *
+             * @param attributes Attributes to set
+             * @param cb A callback to receive the response.
+             *
+             * @throws PlatformException If the operation failed
+             * @throws InvalidParameterException If cb is an empty function or null.
+             *
+             * @see RCSResourceObject
+             * @see RCSResourceObject::SetRequestHandlerPolicy
+             *
+             * @note The callback will be invoked in an internal thread.
+             */
+            void set(const RCSResourceAttributes& attributes, SetCallback cb);
+
+            /**
+             * Sends a set request with resource attributes to the server.
+             *
+             * The SetRequest behavior depends on query parameters and the server.
+             *
+             * @param queryParams Query parameters
+             * @param attributes Attributes to set
+             * @param cb A callback to receive the response.
+             *
+             * @throws PlatformException If the operation failed
+             * @throws InvalidParameterException If cb is an empty function or null.
+             *
+             * @see RCSResourceObject
+             * @see RCSResourceObject::SetRequestHandlerPolicy
+             *
+             * @note The callback will be invoked in an internal thread.
+             */
+            void set(const RCSQueryParams& queryParams, const RCSResourceAttributes& attributes,
+                    SetCallback cb);
+
+            /**
+             * Sends a set request with resource representation to the server.
+             *
+             * The SetRequest behavior depends on query parameters and the server.
+             *
+             * @param queryParams Query parameters
+             * @param rep Representation to set
+             * @param cb A callback to receive the response.
+             *
+             * @throws PlatformException If the operation failed
+             * @throws InvalidParameterException If cb is an empty function or null.
+             *
+             * @see RCSResourceObject
+             * @see RCSResourceObject::SetRequestHandlerPolicy
+             *
+             * @note The callback will be invoked in an internal thread.
+             */
+            void set(const RCSQueryParams& queryParams, const RCSRepresentation &rep,
+                    SetCallback cb);
+
+            /**
+             * Returns the uri of the resource.
+             *
+             */
+            std::string getUri() const;
+
+            /**
+             * Returns the address of the resource .
+             *
+             */
+            std::string getAddress() const;
+
+            /**
+             * Returns the resource types of the resource.
+             *
+             */
+            std::vector< std::string > getTypes() const;
+
+            /**
+             * Returns the resource interfaces of the resource.
+             *
+             */
+            std::vector< std::string > getInterfaces() const;
+
+        private:
+            std::shared_ptr< PrimitiveResource > m_primitiveResource;
+            CacheID m_cacheId;
+            BrokerID m_brokerId;
         };
     }
 }
-#endif //RCS_RemoteResourceObject_H
+#endif // RCSREMOTERESOURCEOBJECT_H