diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index 36b676af40b7bb..1321475d3e8314 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -125,7 +125,7 @@ void EventManagement::Init(Messaging::ExchangeManager * apExchangeManager, uint3 mMonotonicStartupTime = aMonotonicStartupTime; - // Should remove using the global instance and rely only on passed in variable. + // TODO(#36890): Should remove using the global instance and rely only on passed in variable. if (apEventReporter == nullptr) { mpEventReporter = &InteractionModelEngine::GetInstance()->GetReportingEngine(); @@ -500,10 +500,7 @@ CHIP_ERROR EventManagement::LogEventPrivate(EventLoggingDelegate * apDelegate, c opts.mTimestamp.mType == Timestamp::Type::kSystem ? "Sys" : "Epoch", ChipLogValueX64(opts.mTimestamp.mValue)); #endif // CHIP_CONFIG_EVENT_LOGGING_VERBOSE_DEBUG_LOGS - if (mpEventReporter) - { - err = mpEventReporter->NewEventGenerated(opts.mPath, mBytesWritten); - } + err = mpEventReporter->NewEventGenerated(opts.mPath, mBytesWritten); } return err; diff --git a/src/app/EventManagement.h b/src/app/EventManagement.h index fe5a14b6d04ee7..f5687b586e02f4 100644 --- a/src/app/EventManagement.h +++ b/src/app/EventManagement.h @@ -226,8 +226,7 @@ class EventManagement : public DataModel::EventsGenerator * time 0" for cases when we use * system-time event timestamps. * - * @param[in] apEventReporter Event reporter to deliver the event, default is the reporting - * engine in InteractionModelEngine. + * @param[in] apEventReporter Event reporter to be notified when events are generated. * */ void Init(Messaging::ExchangeManager * apExchangeManager, uint32_t aNumBuffers, CircularEventBuffer * apCircularEventBuffer, diff --git a/src/app/EventReporter.h b/src/app/EventReporter.h index 9ae267de232f51..aaba792b6a1d99 100644 --- a/src/app/EventReporter.h +++ b/src/app/EventReporter.h @@ -25,8 +25,7 @@ namespace chip { namespace app { /** - * Define EventReporter interface. Event reporter is used by EventManagement to notify that events are ready to be reported. - * Usually this is implemented by the Reporting Engine to find the proper ReadHandlers and deliver the events. + * Interface that EventManagement can use to notify when events are generated and may need reporting. * */ class EventReporter @@ -35,12 +34,12 @@ class EventReporter virtual ~EventReporter() = default; /** - * Notify of a new event generated. + * Notify that an event was generated. * - * @param[in] aPath The path to the event. - * @param[in] aBytesWritten Bytes that the event is written into the buffer in EventManagement. + * @param[in] aPath The path that identifies the kind of event that was generated. + * @param[in] aBytesConsumed The number of bytes needed to store the event in EventManagement. */ - CHIP_ERROR virtual NewEventGenerated(ConcreteEventPath & aPath, uint32_t aBytesWritten) = 0; + CHIP_ERROR virtual NewEventGenerated(ConcreteEventPath & aPath, uint32_t aBytesConsumed) = 0; }; } // namespace app diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index dce25c5f352c58..c5a4a0811d274b 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -126,7 +126,7 @@ class InteractionModelEngine : public Messaging::UnsolicitedMessageHandler, * @param[in] apExchangeMgr A pointer to the ExchangeManager object. * @param[in] apFabricTable A pointer to the FabricTable object. * @param[in] apCASESessionMgr An optional pointer to a CASESessionManager (used for re-subscriptions). - * @parma[in] eventManagement An optional pointer to a EventManagement. Use the global instance if not presented. + * @parma[in] eventManagement An optional pointer to a EventManagement. If null, the global instance will be used. * */ CHIP_ERROR Init(Messaging::ExchangeManager * apExchangeMgr, FabricTable * apFabricTable, diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index 4f58a0450bf4cc..a9cef5c27dc333 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -1131,7 +1131,7 @@ CHIP_ERROR Engine::ScheduleBufferPressureEventDelivery(uint32_t aBytesWritten) return CHIP_NO_ERROR; } -CHIP_ERROR Engine::NewEventGenerated(ConcreteEventPath & aPath, uint32_t aBytesWritten) +CHIP_ERROR Engine::NewEventGenerated(ConcreteEventPath & aPath, uint32_t aBytesConsumed) { // If we literally have no read handlers right now that care about any events, // we don't need to call schedule run for event. @@ -1169,7 +1169,7 @@ CHIP_ERROR Engine::NewEventGenerated(ConcreteEventPath & aPath, uint32_t aBytesW return CHIP_NO_ERROR; } - return ScheduleBufferPressureEventDelivery(aBytesWritten); + return ScheduleBufferPressureEventDelivery(aBytesConsumed); } void Engine::ScheduleUrgentEventDeliverySync(Optional fabricIndex) diff --git a/src/app/reporting/Engine.h b/src/app/reporting/Engine.h index 69df9e4422241a..6f60da7d8f9caf 100644 --- a/src/app/reporting/Engine.h +++ b/src/app/reporting/Engine.h @@ -179,10 +179,10 @@ class Engine : public DataModel::ProviderChangeListener, public EventReporter const ConcreteReadAttributePath & aPath); /** - * EventReporter implementations. + * EventReporter implementation. * */ - CHIP_ERROR NewEventGenerated(ConcreteEventPath & aPath, uint32_t aBytesWritten) override; + CHIP_ERROR NewEventGenerated(ConcreteEventPath & aPath, uint32_t aBytesConsumed) override; /** * Send Report via ReadHandler