From 2cfb338e470ed935f93b5e91064dde6cf599aad0 Mon Sep 17 00:00:00 2001 From: Mathieu Kardous Date: Thu, 3 Oct 2024 15:39:03 -0400 Subject: [PATCH] Fix empty report feedback loop --- src/app/reporting/ReportScheduler.h | 2 ++ src/app/reporting/SynchronizedReportSchedulerImpl.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/reporting/ReportScheduler.h b/src/app/reporting/ReportScheduler.h index f0e6ce3ff82f27..d704c4d9f923b7 100644 --- a/src/app/reporting/ReportScheduler.h +++ b/src/app/reporting/ReportScheduler.h @@ -150,6 +150,7 @@ class ReportScheduler : public ReadHandler::Observer, public ICDStateObserver IsEngineRunScheduled())); } + bool CanStartReporting() const { return mReadHandler->CanStartReporting(); } bool IsChunkedReport() const { return mReadHandler->IsChunkedReport(); } bool IsEngineRunScheduled() const { return mFlags.Has(ReadHandlerNodeFlags::EngineRunScheduled); } void SetEngineRunScheduled(bool aEngineRunScheduled) @@ -231,6 +232,7 @@ class ReportScheduler : public ReadHandler::Observer, public ICDStateObserver #endif // CONFIG_BUILD_FOR_HOST_UNIT_TEST protected: + friend class chip::app::TestReadInteraction; friend class chip::app::reporting::TestReportScheduler; /// @brief Find the ReadHandlerNode for a given ReadHandler pointer diff --git a/src/app/reporting/SynchronizedReportSchedulerImpl.cpp b/src/app/reporting/SynchronizedReportSchedulerImpl.cpp index a402f32b9b10ad..6d04e2b57d2134 100644 --- a/src/app/reporting/SynchronizedReportSchedulerImpl.cpp +++ b/src/app/reporting/SynchronizedReportSchedulerImpl.cpp @@ -183,7 +183,7 @@ void SynchronizedReportSchedulerImpl::TimerFired() VerifyOrReturn(mNodesPool.Allocated()); mNodesPool.ForEachActiveObject([now, &firedEarly](ReadHandlerNode * node) { - if (node->GetMinTimestamp() <= now) + if (node->GetMinTimestamp() <= now && node->CanStartReporting()) { // Since this handler can now report whenever it wants to, mark it as allowed to report if any other handler is // reporting using the CanBeSynced flag.