Skip to content

Commit

Permalink
Update rvc mode cluters with new mode restrictions (#31560)
Browse files Browse the repository at this point in the history
* Updated step 3 in TC 1.1 for RvcRunMode and RvcCleanMode

* Updated TC 1.2 for RvcRunMode and RvcCleanMode cluters.

* Added TC 2.2 for the RvcCleanMode cluster.

* Restyled by autopep8

* Added TC 2.2 for the RvcRunMode cluster.

* Removed unused imports.

* Regenerated zap files.

* Added the PICS provider methods to the new python tests.

* Changed the features supported by the RVC mode cluters in the all-clusters-app to match recent changes in the spec and tests.

* Added the mapping mode tag to the all-clusters-app example

* Changed the response returned by the RVC clean mode's handler of the ChanedToMode command to match the new spec.

* Updated TC_RVCCLEAN_2_2 to remove incorrect type checks.

* Apply suggestions from code review

Co-authored-by: C Freeman <[email protected]>
Co-authored-by: Petru Lauric <[email protected]>

* Updated the RVC run ChangeToMode handler in the all-clusters-app to match the new spec behaviour.

* Updated the cl-pics-values for the RVC Run and Clean clusters.

* Future proofed the enum to text function and change to using the --endpoint flag.

* Fixed retrival of the endpoint setting.

* Simplified some of the test code following review.

* Removed test steps to match the test plan.

* Changed the capture of the endpoint for the RVC run and RVC clean test 2.1.

* Restyled by clang-format

* Restyled by autopep8

* Regenerated zap files.

* Removed duplicate RVCRUNM PICS from the ci-pics-values.

* Updated PICS.yaml to reflect the new PICS requirements for the RvcRunMode and RvcCleanMode clusters.

* Made all RVC python tests consistent regarding the capture of the endpoint and their documentation.

* Apply typo suggestions from code review

Co-authored-by: Petru Lauric <[email protected]>

* Fixed the RVC clean handle change to mode in the all-clusters-app.

* Restyled by clang-format

---------

Co-authored-by: Restyled.io <[email protected]>
Co-authored-by: C Freeman <[email protected]>
Co-authored-by: Petru Lauric <[email protected]>
  • Loading branch information
4 people authored Jan 25, 2024
1 parent a49adac commit fe5dcfe
Show file tree
Hide file tree
Showing 13 changed files with 537 additions and 504 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class RvcRunModeDelegate : public ModeBase::Delegate
using ModeTagStructType = detail::Structs::ModeTagStruct::Type;
ModeTagStructType ModeTagsIdle[1] = { { .value = to_underlying(ModeTag::kIdle) } };
ModeTagStructType ModeTagsCleaning[1] = { { .value = to_underlying(ModeTag::kCleaning) } };
ModeTagStructType ModeTagsMapping[1] = { { .value = to_underlying(ModeTag::kMapping) } };

const detail::Structs::ModeOptionStruct::Type kModeOptions[3] = {
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Idle"),
Expand All @@ -49,10 +50,9 @@ class RvcRunModeDelegate : public ModeBase::Delegate
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Cleaning"),
.mode = ModeCleaning,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsCleaning) },
detail::Structs::ModeOptionStruct::Type{
.label = CharSpan::fromCharString("Mapping"),
.mode = ModeMapping,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsIdle) }, // todo set to no mode tags
detail::Structs::ModeOptionStruct::Type{ .label = CharSpan::fromCharString("Mapping"),
.mode = ModeMapping,
.modeTags = DataModel::List<const ModeTagStructType>(ModeTagsMapping) },
};

CHIP_ERROR Init() override;
Expand Down
15 changes: 7 additions & 8 deletions examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void RvcRunModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Commands:
// Our business logic states that we can only switch into the mapping state from the idle state.
if (NewMode == RvcRunMode::ModeMapping && currentMode != RvcRunMode::ModeIdle)
{
response.status = to_underlying(ModeBase::StatusCode::kGenericFailure);
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
response.statusText.SetValue(chip::CharSpan::fromCharString("Change to the mapping mode is only allowed from idle"));
return;
}
Expand Down Expand Up @@ -112,8 +112,7 @@ void emberAfRvcRunModeClusterInitCallback(chip::EndpointId endpointId)
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
VerifyOrDie(gRvcRunModeDelegate == nullptr && gRvcRunModeInstance == nullptr);
gRvcRunModeDelegate = new RvcRunMode::RvcRunModeDelegate;
gRvcRunModeInstance =
new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id, chip::to_underlying(RvcRunMode::Feature::kOnOff));
gRvcRunModeInstance = new ModeBase::Instance(gRvcRunModeDelegate, 0x1, RvcRunMode::Id, 0);
gRvcRunModeInstance->Init();
}

Expand All @@ -130,10 +129,11 @@ void RvcCleanModeDelegate::HandleChangeToMode(uint8_t NewMode, ModeBase::Command
{
uint8_t rvcRunCurrentMode = gRvcRunModeInstance->GetCurrentMode();

if (rvcRunCurrentMode == RvcRunMode::ModeCleaning)
if (rvcRunCurrentMode != RvcRunMode::ModeIdle)
{
response.status = to_underlying(RvcCleanMode::StatusCode::kCleaningInProgress);
response.statusText.SetValue(chip::CharSpan::fromCharString("Cannot change the cleaning mode during a clean"));
response.status = to_underlying(ModeBase::StatusCode::kInvalidInMode);
response.statusText.SetValue(
chip::CharSpan::fromCharString("Cannot change the cleaning mode when the device is not in idle"));
return;
}

Expand Down Expand Up @@ -201,7 +201,6 @@ void emberAfRvcCleanModeClusterInitCallback(chip::EndpointId endpointId)
VerifyOrDie(endpointId == 1); // this cluster is only enabled for endpoint 1.
VerifyOrDie(gRvcCleanModeDelegate == nullptr && gRvcCleanModeInstance == nullptr);
gRvcCleanModeDelegate = new RvcCleanMode::RvcCleanModeDelegate;
gRvcCleanModeInstance =
new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id, chip::to_underlying(RvcCleanMode::Feature::kOnOff));
gRvcCleanModeInstance = new ModeBase::Instance(gRvcCleanModeDelegate, 0x1, RvcCleanMode::Id, 0);
gRvcCleanModeInstance->Init();
}
13 changes: 2 additions & 11 deletions src/app/tests/suites/certification/PICS.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9116,12 +9116,6 @@ PICS:
- label: "Does the device implement the CurrentMode attribute?"
id: RVCCLEANM.S.A0001

- label: "Does the device implement the StartUpMode attribute?"
id: RVCCLEANM.S.A0002

- label: "Does the device implement the OnMode attribute?"
id: RVCCLEANM.S.A0003

#
# server / Commands received
#
Expand Down Expand Up @@ -9334,11 +9328,8 @@ PICS:
- label: "Does the device implement the CurrentMode attribute?"
id: RVCRUNM.S.A0001

- label: "Does the device implement the StartUpMode attribute?"
id: RVCRUNM.S.A0002

- label: "Does the device implement the OnMode attribute?"
id: RVCRUNM.S.A0003
- label: "Can the mode change be manually controlled?"
id: RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED

#Commands received
- label: "Does the device implement receiving the ChangeToMode command?"
Expand Down
34 changes: 0 additions & 34 deletions src/app/tests/suites/certification/Test_TC_RVCCLEANM_1_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,13 @@ tests:
type: int16u

- label: "Step 3: TH reads from the DUT the FeatureMap attribute."
PICS: " !RVCCLEANM.S.F00 "
command: "readAttribute"
attribute: "FeatureMap"
response:
value: 0
constraints:
type: bitmap32

- label:
"Step 3: Given RVCCLEANM.S.F00(DEPONOFF) ensure featuremap has the
correct bit set"
PICS: RVCCLEANM.S.F00
command: "readAttribute"
attribute: "FeatureMap"
response:
constraints:
type: bitmap32
hasMasksSet: [0x1]

- label: "Step 4a: TH reads from the DUT the AttributeList attribute."
PICS: PICS_EVENT_LIST_ENABLED
command: "readAttribute"
Expand All @@ -79,28 +67,6 @@ tests:
type: list
contains: [0, 1, 65528, 65529, 65531, 65532, 65533]

- label:
"Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF)
and optional attribute(OnMode) is in AttributeList from the DUT"
PICS: RVCCLEANM.S.F00
command: "readAttribute"
attribute: "AttributeList"
response:
constraints:
type: list
contains: [3]

- label:
"Step 4c: TH reads the Feature dependent(RVCCLEANM.S.F00 - DEPONOFF)
and optional attribute(OnMode) is not in AttributeList from the DUT"
PICS: " !RVCCLEANM.S.F00 "
command: "readAttribute"
attribute: "AttributeList"
response:
constraints:
type: list
excludes: [3]

- label: "Step 5: TH reads from the DUT the EventList attribute."
PICS: PICS_EVENT_LIST_ENABLED
command: "readAttribute"
Expand Down
36 changes: 1 addition & 35 deletions src/app/tests/suites/certification/Test_TC_RVCRUNM_1_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,14 @@ tests:
constraints:
type: int16u

- label: "Step 3a: TH reads from the DUT the FeatureMap attribute."
PICS: " !RVCRUNM.S.F00 "
- label: "Step 3: TH reads from the DUT the FeatureMap attribute."
command: "readAttribute"
attribute: "FeatureMap"
response:
value: 0
constraints:
type: bitmap32

- label:
"Step 3b: Given RVCRUNM.S.F00(DEPONOFF) ensure featuremap has the
correct bit set"
PICS: RVCRUNM.S.F00
command: "readAttribute"
attribute: "FeatureMap"
response:
constraints:
type: bitmap32
hasMasksSet: [0x1]

- label: "Step 4a: TH reads from the DUT the AttributeList attribute."
PICS: PICS_EVENT_LIST_ENABLED
command: "readAttribute"
Expand All @@ -79,28 +67,6 @@ tests:
type: list
contains: [0, 1, 65528, 65529, 65531, 65532, 65533]

- label:
"Step 4c: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and
optional attribute(OnMode) is in AttributeList from the DUT"
PICS: RVCRUNM.S.F00
command: "readAttribute"
attribute: "AttributeList"
response:
constraints:
type: list
contains: [3]

- label:
"Step 4d: TH reads the Feature dependent(RVCRUNM.S.F00 - DEPONOFF) and
optional attribute(OnMode) is not in AttributeList from the DUT"
PICS: " !RVCRUNM.S.F00 "
command: "readAttribute"
attribute: "AttributeList"
response:
constraints:
type: list
excludes: [3]

- label: "Step 5: TH reads from the DUT the EventList attribute."
PICS: PICS_EVENT_LIST_ENABLED
command: "readAttribute"
Expand Down
19 changes: 3 additions & 16 deletions src/app/tests/suites/certification/ci-pics-values
Original file line number Diff line number Diff line change
Expand Up @@ -2438,11 +2438,9 @@ RVCCLEANM.S=1
#Server
RVCCLEANM.S.A0000=1
RVCCLEANM.S.A0001=1
RVCCLEANM.S.A0002=0
RVCCLEANM.S.A0003=1

#Feature
RVCCLEANM.S.F00=1
RVCCLEANM.S.F00=0

#commands
RVCCLEANM.S.C00.Rsp=1
Expand Down Expand Up @@ -2506,19 +2504,18 @@ RVCOPSTATE.C.C04.Tx=1

# RVC RUN MODE CLUSTER
RVCRUNM.S=1
RVCRUNM.S.F00=1
RVCRUNM.S.F00=0

#Server
RVCRUNM.S.A0000=1
RVCRUNM.S.A0001=1
RVCRUNM.S.A0002=0
RVCRUNM.S.A0003=1

#Commands
RVCRUNM.S.C00.Rsp=1
RVCRUNM.S.C01.Tx=1

RVCRUNM.S.M.CAN_TEST_MODE_FAILURE=1
RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED=1

#PIXIT
PIXIT.RVCRUNM.MODE_CHANGE_FAIL=1
Expand Down Expand Up @@ -2691,16 +2688,6 @@ WASHERCTRL.S.M.ManuallyControlledSpin=1
WASHERCTRL.S.M.ManuallyControlledRinse=1
WASHERCTRL.S.M.ManuallyControlled=0

#RVC Run Mode
RVCRUNM.S=1
RVCRUNM.S.F00=1
RVCRUNM.S.A0000=1
RVCRUNM.S.A0001=1
RVCRUNM.S.A0002=0
RVCRUNM.S.A0003=1
RVCRUNM.S.C00.Rsp=1
RVCRUNM.S.C01.Tx=1

#Refrigerator Alarm
REFALM.S=1
REFALM.C=1
Expand Down
Loading

0 comments on commit fe5dcfe

Please sign in to comment.