Skip to content

Commit

Permalink
Fix some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yyzhong-g committed Dec 18, 2024
1 parent 8809618 commit 749f4aa
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 18 deletions.
7 changes: 2 additions & 5 deletions src/app/EventManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions src/app/EventManagement.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 5 additions & 6 deletions src/app/EventReporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/app/InteractionModelEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/app/reporting/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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> fabricIndex)
Expand Down
4 changes: 2 additions & 2 deletions src/app/reporting/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 749f4aa

Please sign in to comment.