Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
lpbeliveau-silabs and bzbarsky-apple authored Jul 13, 2023
1 parent e81641d commit 2a55ac5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/ReadHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class ReadHandler : public Messaging::ExchangeDelegate
}

/*
* Set the maximum reporting intervals for the subscription. This SHALL only be called
* Set the maximum reporting interval for the subscription. This SHALL only be called
* from the OnSubscriptionRequested callback above. The restriction is as below
* MinIntervalFloor ≤ MaxInterval ≤ MAX(SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT, MaxIntervalCeiling)
* Where SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT is set to 60m in the spec.
Expand Down
8 changes: 4 additions & 4 deletions src/app/reporting/ReportScheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class ReportScheduler : public ReadHandler::Observer
{
public:
virtual ~TimerDelegate() {}
/// @brief Start a timer for a given context, the report scheduler will always start by trying to cancel an existing timer
/// before starting a new one
/// @param context context to pass to the timer callback, in this case, a read handler node is passed
/// @brief Start a timer for a given context. The report scheduler must always cancel an existing timer for a context (using CancelTimer)
/// before starting a new one for that context.
/// @param context context to pass to the timer callback.
/// @param aTimeout time in miliseconds before the timer expires
virtual CHIP_ERROR StartTimer(void * context, System::Clock::Timeout aTimeout) = 0;
/// @brief Cancel a timer for a given context
Expand All @@ -70,7 +70,7 @@ class ReportScheduler : public ReadHandler::Observer
}
ReadHandler * GetReadHandler() const { return mReadHandler; }
/// @brief Check if the Node is reportable now, meaning its readhandler was made reportable by attribute dirtying and
/// handler state, and minimal time interval last since last report has elapsed, or the maximal time interval since last
/// handler state, and minimal time interval since last report has elapsed, or the maximal time interval since last
/// report has elapsed
bool IsReportableNow() const
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/reporting/ReportSchedulerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void ReportSchedulerImpl::OnReadHandlerDestroyed(ReadHandler * aReadHandler)
CHIP_ERROR ReportSchedulerImpl::RegisterReadHandler(ReadHandler * aReadHandler)
{
ReadHandlerNode * newNode = FindReadHandlerNode(aReadHandler);
// If the handler is already registered, no need to register it again
// Handler must not be registered yet; it's just being constructed.
VerifyOrDie(nullptr == newNode);
// The NodePool is the same size as the ReadHandler pool from the IM Engine, so we don't need a check for size here since if a
// ReadHandler was created, space should be available.
Expand All @@ -102,7 +102,7 @@ CHIP_ERROR ReportSchedulerImpl::RegisterReadHandler(ReadHandler * aReadHandler)
Timestamp now = mTimerDelegate->GetCurrentMonotonicTimestamp();
Milliseconds32 newTimeout;
// If the handler is reportable, schedule a report for the min interval, otherwise schedule a report for the max interval
if ((newNode->IsReportableNow()))
if (newNode->IsReportableNow())
{
// If the handler is reportable now, just schedule a report immediately
newTimeout = Milliseconds32(0);
Expand Down

0 comments on commit 2a55ac5

Please sign in to comment.