Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yunhanw-google committed Aug 18, 2022
1 parent 13fad63 commit 8e408d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/app/ReadHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ CHIP_ERROR ReadHandler::SendReportData(System::PacketBufferHandle && aPayload, b
{
mPreviousReportsBeginGeneration = mCurrentReportsBeginGeneration;
ClearForceDirtyFlag();
ClearUrgentEventFlag();
InteractionModelEngine::GetInstance()->ReleaseDataVersionFilterList(mpDataVersionFilterList);
}

Expand Down
15 changes: 8 additions & 7 deletions src/app/ReadHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,12 @@ class ReadHandler : public Messaging::ExchangeDelegate
// mPreviousReportsBeginGeneration will be set to mCurrentReportsBeginGeneration after we send the last
// chunk of the current report. Anything that was dirty with a generation earlier than
// mPreviousReportsBeginGeneration has had its value sent to the client.
// when receiving initial request, it needs mark current handler as dirty
ForceDirty = (1 << 6),
UrgentEvent = (1 << 7),
// when receiving initial request, it needs mark current handler as dirty.
// when there is urgent event, it needs mark current handler as dirty.
ForceDirty = (1 << 6),

// Don't need the response for report data if true
SuppressResponse = (1 << 7),
};

/**
Expand Down Expand Up @@ -294,10 +297,8 @@ class ReadHandler : public Messaging::ExchangeDelegate
void SetDirty(const AttributePathParams & aAttributeChanged);
bool IsDirty() const
{
return (mDirtyGeneration > mPreviousReportsBeginGeneration) || mFlags.Has(ReadHandlerFlags::UrgentEvent) ||
mFlags.Has(ReadHandlerFlags::ForceDirty);
return (mDirtyGeneration > mPreviousReportsBeginGeneration) || mFlags.Has(ReadHandlerFlags::ForceDirty);
}
void ClearUrgentEventFlag() { mFlags.Clear(ReadHandlerFlags::UrgentEvent); }
void ClearForceDirtyFlag() { mFlags.Clear(ReadHandlerFlags::ForceDirty); }
NodeId GetInitiatorNodeId() const
{
Expand All @@ -316,7 +317,7 @@ class ReadHandler : public Messaging::ExchangeDelegate

auto GetTransactionStartGeneration() const { return mTransactionStartGeneration; }

void UnblockUrgentEventDelivery() { mFlags.Set(ReadHandlerFlags::UrgentEvent); }
void UnblockUrgentEventDelivery() { mFlags.Set(ReadHandlerFlags::ForceDirty); }

const AttributeValueEncoder::AttributeEncodeState & GetAttributeEncodeState() const { return mAttributeEncoderState; }
void SetAttributeEncodeState(const AttributeValueEncoder::AttributeEncodeState & aState) { mAttributeEncoderState = aState; }
Expand Down
1 change: 1 addition & 0 deletions src/app/tests/TestReadInteraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,7 @@ void TestReadInteraction::TestSubscribeRoundtrip(nlTestSuite * apSuite, void * a
// Test report with 2 different path
delegate.mpReadHandler->mFlags.Set(ReadHandler::ReadHandlerFlags::HoldReport, false);
delegate.mGotReport = false;
delegate.mGotEventResponse = false;
delegate.mNumAttributeResponse = 0;

printf("HereHere\n");
Expand Down

0 comments on commit 8e408d3

Please sign in to comment.