Skip to content

Commit

Permalink
[OPSTATE] fix: Transition error in the Paused Command (#28187)
Browse files Browse the repository at this point in the history
* fix:when in a Stopped State, will transition to the Paused State on reception of a Pause command.

* Fix CI error in TestRVCOperationalState.yaml

* zap regen all for test plan
  • Loading branch information
mideayanghui authored Jul 22, 2023
1 parent 8f7dd90 commit 8949209
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ void OperationalStateServer::HandlePauseState(HandlerContext & ctx, const Comman
VerifyOrReturn(delegate != nullptr, ctx.mCommandHandler.AddStatus(ctx.mRequestPath, Status::Failure));
uint8_t opState = delegate->GetCurrentOperationalState();

if (opState != to_underlying(OperationalStateEnum::kPaused))
if (opState != to_underlying(OperationalStateEnum::kPaused) && opState != to_underlying(OperationalStateEnum::kRunning))
{
err.Set(to_underlying(ErrorStateEnum::kCommandInvalidInState));
}
else if (opState != to_underlying(OperationalStateEnum::kPaused))
{
delegate->HandlePauseStateCallback(err);
}
Expand Down
10 changes: 5 additions & 5 deletions src/app/tests/suites/TestRVCOperationalState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,26 @@ tests:
response:
values:
- name: "CommandResponseState"
value: { ErrorStateID: 0 }
value: { ErrorStateID: 3 }

- label: "Read current Operational State"
command: "readAttribute"
attribute: "OperationalState"
response:
value: 2
value: 0

- label: "Resume Command"
command: "Resume"
response:
values:
- name: "CommandResponseState"
value: { ErrorStateID: 0 }
value: { ErrorStateID: 3 }

- label: "Read current Operational State"
command: "readAttribute"
attribute: "OperationalState"
response:
value: 1
value: 0

- label: "Stop Command"
command: "Stop"
Expand All @@ -119,4 +119,4 @@ tests:
command: "readAttribute"
attribute: "OperationalState"
response:
value: 1
value: 0
10 changes: 5 additions & 5 deletions zzz_generated/chip-tool/zap-generated/test/Commands.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8949209

Please sign in to comment.