Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the service area server to check if there are any selected area… #35722

Merged
merged 5 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/app/clusters/service-area-server/service-area-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,19 @@ void Instance::HandleSkipAreaCmd(HandlerContext & ctx, const Commands::SkipArea:
ctx.mCommandHandler.AddResponse(ctx.mRequestPath, response);
};

// The SkippedArea field SHALL match an entry in the SupportedAreas list.
// If the Status field is set to InvalidAreaList, the StatusText field SHALL be an empty string.
// If the SelectedAreas attribute is empty, the SkipAreaResponse command’s Status field SHALL indicate InvalidAreaList.
if (GetNumberOfSelectedAreas() == 0)
{
exitResponse(SkipAreaStatus::kInvalidAreaList, ""_span);
return;
}

// If the SkippedArea field does not match an entry in the SupportedAreas attribute, the SkipAreaResponse command’s Status field
// SHALL indicate InvalidSkippedArea.
if (!mStorageDelegate->IsSupportedArea(req.skippedArea))
{
ChipLogError(Zcl, "SkippedArea (%" PRIu32 ") is not in the SupportedAreas attribute.", req.skippedArea);
exitResponse(SkipAreaStatus::kInvalidAreaList, ""_span);
exitResponse(SkipAreaStatus::kInvalidSkippedArea, ""_span);
return;
}

Expand Down
18 changes: 11 additions & 7 deletions src/python_testing/TC_SEAR_1_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,28 @@ async def test_TC_SEAR_1_5(self):
test_step = "Manually intervene to put the device in a state that prevents it from executing the SkipArea command \
(e.g. set CurrentArea to null or make it not operate, i.e. be in the idle state)"
hicklin marked this conversation as resolved.
Show resolved Hide resolved
self.print_step("3", test_step)
if not self.is_ci:
if self.is_ci:
await self.send_single_cmd(cmd=Clusters.Objects.ServiceArea.Commands.SelectAreas(newAreas=[7]),
endpoint=self.endpoint)
else:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.send_cmd_skip_area_expect_response(step=4, skipped_area=valid_area_id,
expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidInMode)
await self.send_cmd_skip_area_expect_response(step=4, skipped_area=valid_area_id,
expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidInMode)

if self.check_pics("SEAR.S.M.NO_SELAREA_FOR_SKIP") and self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"):
test_step = "Manually intervene to put the device in a state where the state would allow it to execute the SkipArea command, \
if SelectedAreas wasn't empty, and SelectedAreas is empty"
self.print_step("5", test_step)
if self.is_ci:
self.write_to_app_pipe({"Name": "Reset"})
await self.send_single_cmd(cmd=Clusters.Objects.RvcRunMode.Commands.ChangeToMode(newMode=1),
endpoint=self.endpoint)
else:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.send_cmd_skip_area_expect_response(step=6, skipped_area=valid_area_id,
expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidAreaList)
await self.send_cmd_skip_area_expect_response(step=6, skipped_area=valid_area_id,
expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidAreaList)

if self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP") and self.check_pics("SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL"):
test_step = "Manually intervene to put the device in a state that allows it to execute the SkipArea command"
Expand All @@ -148,8 +152,8 @@ async def test_TC_SEAR_1_5(self):
else:
self.wait_for_user_input(prompt_msg=f"{test_step}, and press Enter when done.\n")

await self.send_cmd_skip_area_expect_response(step=8, skipped_area=invalid_area_id,
expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidSkippedArea)
await self.send_cmd_skip_area_expect_response(step=8, skipped_area=invalid_area_id,
expected_response=Clusters.ServiceArea.Enums.SkipAreaStatus.kInvalidSkippedArea)

if not self.check_pics("SEAR.S.M.VALID_STATE_FOR_SKIP"):
return
Expand Down
Loading