{
}
- void ObserveCache::startCache(DataCacheCB func)
+ void ObserveCache::startCache(DataCacheCB func, bool reportAll)
{
if (m_isStart)
{
std::bind(&ObserveCache::verifyObserveCB,
std::placeholders::_1, std::placeholders::_2,
std::placeholders::_3, std::placeholders::_4,
- shared_from_this()));
+ shared_from_this(), reportAll));
}
else
{
}
void ObserveCache::onObserve(const HeaderOptions &,
- const ResponseStatement & rep, int _result, unsigned int)
+ const ResponseStatement & rep, int _result, unsigned int, bool reportAll)
{
+
+ std::cout << "onObserve (observecache.cpp) reportAll: " << reportAll << std::endl;
+
std::lock_guard<std::mutex> lock(m_cbMutex);
m_state = CACHE_STATE::READY;
- if (m_attributes == rep.getAttributes() &&
+ if (!reportAll && m_attributes == rep.getAttributes() &&
convertOCResultToSuccess((OCStackResult)_result))
{
return;
void ObserveCache::verifyObserveCB(const HeaderOptions &_hos,
const ResponseStatement &_rep, int _result,
- unsigned int _seq, weakDataCache wPtr)
+ unsigned int _seq, weakDataCache wPtr, bool reportAll)
{
auto ptr = wPtr.lock();
if (ptr)
{
- ptr->onObserve(_hos, _rep, _result, _seq);
+ ptr->onObserve(_hos, _rep, _result, _seq, reportAll);
}
}
case OC_STACK_OK:
case OC_STACK_RESOURCE_CREATED:
case OC_STACK_RESOURCE_DELETED:
+#ifdef WITH_PRESENCE
case OC_STACK_PRESENCE_STOPPED:
+#endif
case OC_STACK_CONTINUE:
case OC_STACK_RESOURCE_CHANGED:
return true;