replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / resource-encapsulation / include / RCSRemoteResourceObject.h
index 5882c0f..e5af9a2 100644 (file)
@@ -66,6 +66,12 @@ namespace OIC
             LOST_SIGNAL, /**< Failed to reach the resource. */
         };
 
+        enum class CacheMode
+        {
+            OBSERVE_ONLY,
+            OBSERVE_WITH_POLLING
+        };
+
         /**
          * The states of monitoring.
          *
@@ -163,7 +169,7 @@ namespace OIC
          * @see RCSDiscoveryManager
          *
          */
-        class RCSRemoteResourceObject
+        class RCSRemoteResourceObject : public std::enable_shared_from_this<RCSRemoteResourceObject>
         {
         public:
             typedef std::shared_ptr< RCSRemoteResourceObject > Ptr;
@@ -181,7 +187,8 @@ namespace OIC
              *
              * @param attrs the updated attributes
              */
-            typedef std::function< void(const RCSResourceAttributes& attrs) > CacheUpdatedCallback;
+            typedef std::function< void(const RCSResourceAttributes& attrs, int eCode) >
+                CacheUpdatedCallback;
 
             /**
              * Callback definition to be invoked when the response of getRemoteAttributes is
@@ -343,6 +350,7 @@ namespace OIC
              * 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.
              *
@@ -355,7 +363,7 @@ namespace OIC
              * @see getCachedAttribute(const std::string&) const
              *
              */
-            void startCaching(CacheUpdatedCallback cb);
+            void startCaching(CacheUpdatedCallback cb, CacheMode mode = CacheMode::OBSERVE_WITH_POLLING);
 
             /**
              * Stops caching.