Observation without caching.
[platform/upstream/iotivity.git] / service / resource-encapsulation / src / resourceCache / include / ObserveCache.h
index a30e8b6..1c19f90 100644 (file)
@@ -39,7 +39,7 @@ namespace OIC
         {
             public:
                 typedef std::function<OCStackResult(std::shared_ptr<PrimitiveResource>,
-                                            const RCSResourceAttributes &)> DataCacheCB;
+                            const RCSResourceAttributes &, int)> DataCacheCB;
                 typedef std::shared_ptr<ObserveCache> Ptr;
 
             public:
@@ -51,7 +51,7 @@ namespace OIC
                 ObserveCache & operator = (const ObserveCache &) = delete;
                 ObserveCache & operator = (ObserveCache &&) = delete;
 
-                void startCache(DataCacheCB func);
+                void startCache(DataCacheCB func, bool reportAll = false);
                 void stopCache();
 
                 CACHE_STATE getCacheState() const;
@@ -73,6 +73,7 @@ namespace OIC
                 RCSResourceAttributes m_attributes;
                 CACHE_STATE m_state;
 
+                std::mutex m_cbMutex;
                 DataCacheCB m_reportCB;
 
                 std::atomic<bool> m_isStart;
@@ -82,9 +83,9 @@ namespace OIC
             private:
                 static void verifyObserveCB(const HeaderOptions &_hos,
                                             const ResponseStatement &_rep, int _result,
-                                            unsigned int _seq, weakDataCache ptr);
+                                            unsigned int _seq, weakDataCache ptr, bool reportAll);
                 void onObserve(const HeaderOptions &_hos,
-                               const ResponseStatement &_rep, int _result, unsigned int _seq);
+                               const ResponseStatement &_rep, int _result, unsigned int _seq, bool reportAll);
                 bool convertOCResultToSuccess(OCStackResult ret);
         };
     } // namespace Service