Skip to content

Commit

Permalink
[chip-tool] Add optional event min argument to read/subscribe events …
Browse files Browse the repository at this point in the history
…commands (project-chip#16867)
  • Loading branch information
vivien-apple authored and andrei-menzopol committed Apr 14, 2022
1 parent fd8c31a commit 4933411
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/chip-tool/commands/clusters/ReportCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ class ReportCommand : public ModelCommand, public chip::app::ReadClient::Callbac
chip::app::ReadPrepareParams params(device->GetSecureSession().Value());
params.mpEventPathParamsList = eventPathParams;
params.mEventPathParamsListSize = pathsCount;
params.mEventNumber = mEventNumber.ValueOr(0);
params.mpAttributePathParamsList = nullptr;
params.mAttributePathParamsListSize = 0;

Expand Down Expand Up @@ -317,6 +318,8 @@ class ReportCommand : public ModelCommand, public chip::app::ReadClient::Callbac
// up needing it in our class's shared code.
chip::Optional<bool> mFabricFiltered;

chip::Optional<chip::EventNumber> mEventNumber;

CHIP_ERROR mError = CHIP_NO_ERROR;
};

Expand Down Expand Up @@ -448,13 +451,15 @@ class ReadEvent : public ReportCommand
{
AddArgument("cluster-id", 0, UINT32_MAX, &mClusterIds);
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
AddArgument("event-min", 0, UINT64_MAX, &mEventNumber);
ReportCommand::AddArguments();
}

ReadEvent(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
ReportCommand("read-event-by-id", credsIssuerConfig), mClusterIds(1, clusterId)
{
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
AddArgument("event-min", 0, UINT64_MAX, &mEventNumber);
ReportCommand::AddArguments();
}

Expand All @@ -464,6 +469,7 @@ class ReadEvent : public ReportCommand
mClusterIds(1, clusterId), mEventIds(1, eventId)
{
AddArgument("event-name", eventName);
AddArgument("event-min", 0, UINT64_MAX, &mEventNumber);
ReportCommand::AddArguments();
}

Expand All @@ -489,6 +495,7 @@ class SubscribeEvent : public ReportCommand
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval);
AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval);
AddArgument("event-min", 0, UINT64_MAX, &mEventNumber);
ReportCommand::AddArguments();
}

Expand All @@ -498,6 +505,7 @@ class SubscribeEvent : public ReportCommand
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval);
AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval);
AddArgument("event-min", 0, UINT64_MAX, &mEventNumber);
ReportCommand::AddArguments();
}

Expand All @@ -509,6 +517,7 @@ class SubscribeEvent : public ReportCommand
AddArgument("attr-name", eventName);
AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval);
AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval);
AddArgument("event-min", 0, UINT64_MAX, &mEventNumber);
ReportCommand::AddArguments();
}

Expand Down

0 comments on commit 4933411

Please sign in to comment.