diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 43e71115a827ea..9381838d79410e 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -2979,6 +2979,67 @@ server cluster OperationalState = 96 { command Resume(): OperationalCommandResponse = 3; } +/** This cluster supports remotely monitoring and, where supported, changing the operational state of a Robotic Vacuum. */ +server cluster RvcOperationalState = 97 { + enum ErrorStateEnum : ENUM8 { + kFailedToFindChargingDock = 64; + kStuck = 65; + kDustBinMissing = 66; + kDustBinFull = 67; + kWaterTankEmpty = 68; + kWaterTankMissing = 69; + kWaterTankLidOpen = 70; + kMopCleaningPadMissing = 71; + } + + enum OperationalStateEnum : ENUM8 { + kSeekingCharger = 64; + kCharging = 65; + kDocked = 66; + } + + struct ErrorStateStruct { + enum8 errorStateID = 0; + optional char_string<64> errorStateLabel = 1; + optional char_string<64> errorStateDetails = 2; + } + + struct OperationalStateStruct { + enum8 operationalStateID = 0; + optional char_string<64> operationalStateLabel = 1; + } + + critical event OperationalError = 0 { + ErrorStateStruct errorState = 0; + } + + info event OperationCompletion = 1 { + ENUM8 completionErrorCode = 0; + optional nullable elapsed_s totalOperationalTime = 1; + optional nullable elapsed_s pausedTime = 2; + } + + readonly attribute nullable CHAR_STRING phaseList[] = 0; + readonly attribute nullable int8u currentPhase = 1; + readonly attribute nullable elapsed_s countdownTime = 2; + readonly attribute OperationalStateStruct operationalStateList[] = 3; + readonly attribute enum8 operationalState = 4; + readonly attribute ErrorStateStruct operationalError = 5; + readonly attribute command_id generatedCommandList[] = 65528; + readonly attribute command_id acceptedCommandList[] = 65529; + readonly attribute event_id eventList[] = 65530; + readonly attribute attrib_id attributeList[] = 65531; + readonly attribute bitmap32 featureMap = 65532; + readonly attribute int16u clusterRevision = 65533; + + response struct OperationalCommandResponse = 4 { + ErrorStateStruct commandResponseState = 0; + } + + command Pause(): OperationalCommandResponse = 0; + command Resume(): OperationalCommandResponse = 3; +} + /** Attributes and commands for monitoring HEPA filters in a device */ server cluster HepaFilterMonitoring = 113 { enum ChangeIndicationEnum : ENUM8 { @@ -6632,6 +6693,23 @@ endpoint 1 { ram attribute clusterRevision default = 1; } + server cluster RvcOperationalState { + emits event OperationalError; + emits event OperationCompletion; + callback attribute phaseList; + callback attribute currentPhase default = 0; + callback attribute countdownTime default = 0; + callback attribute operationalStateList default = 0; + callback attribute operationalState default = 0; + callback attribute operationalError default = 0; + callback attribute generatedCommandList default = 0; + callback attribute acceptedCommandList default = 0; + callback attribute eventList default = 0; + callback attribute attributeList default = 0; + ram attribute featureMap default = 0; + ram attribute clusterRevision default = 1; + } + server cluster HepaFilterMonitoring { callback attribute condition; callback attribute degradationDirection; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 54f2e2fe532e15..9e7e08f0f57a3e 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -16043,6 +16043,294 @@ } ] }, + { + "name": "RVC Operational State", + "code": 97, + "mfgCode": null, + "define": "OPERATIONAL_STATE_RVC_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "Pause", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "Resume", + "code": 3, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "RVC Operational State", + "code": 97, + "mfgCode": null, + "define": "OPERATIONAL_STATE_RVC_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [ + { + "name": "OperationalCommandResponse", + "code": 4, + "mfgCode": null, + "source": "server", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "PhaseList", + "code": 0, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CurrentPhase", + "code": 1, + "mfgCode": null, + "side": "server", + "type": "int8u", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "CountdownTime", + "code": 2, + "mfgCode": null, + "side": "server", + "type": "elapsed_s", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OperationalStateList", + "code": 3, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OperationalState", + "code": 4, + "mfgCode": null, + "side": "server", + "type": "enum8", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OperationalError", + "code": 5, + "mfgCode": null, + "side": "server", + "type": "ErrorStateStruct", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "GeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AcceptedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "EventList", + "code": 65530, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "type": "array", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "type": "bitmap32", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "type": "int16u", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ], + "events": [ + { + "name": "OperationalError", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1 + }, + { + "name": "OperationCompletion", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1 + } + ] + }, { "name": "HEPA Filter Monitoring", "code": 113, diff --git a/examples/all-clusters-app/all-clusters-common/src/operational-state-delegates.cpp b/examples/all-clusters-app/all-clusters-common/src/operational-state-delegates.cpp index 9d4a5cec4b111e..2b8bb08be608ca 100644 --- a/examples/all-clusters-app/all-clusters-common/src/operational-state-delegates.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/operational-state-delegates.cpp @@ -82,6 +82,29 @@ static OperationalStateDelegate opStateDelegate(to_underlying(OperationalStateEn Span(opStateList), Span(opPhaseList)); +/** + * RVC Operational State List + * Note: User Define + */ +static const GenericOperationalState rvcOpStateList[] = { + GenericOperationalState(to_underlying(OperationalStateEnum::kStopped)), + GenericOperationalState(to_underlying(OperationalStateEnum::kRunning)), + GenericOperationalState(to_underlying(OperationalStateEnum::kPaused)), + GenericOperationalState(to_underlying(OperationalStateEnum::kError)), + GenericOperationalState(to_underlying(Clusters::RvcOperationalState::OperationalStateEnum::kSeekingCharger)), + GenericOperationalState(to_underlying(Clusters::RvcOperationalState::OperationalStateEnum::kCharging)), + GenericOperationalState(to_underlying(Clusters::RvcOperationalState::OperationalStateEnum::kDocked)), +}; + +/** + * RVC Operational State Delegate + * Note: User Define + */ +static OperationalStateDelegate rvcOpStateDelegate(to_underlying(OperationalStateEnum::kStopped), + GenericOperationalError(to_underlying(ErrorStateEnum::kNoError)), + Span(rvcOpStateList), + Span(opPhaseList)); + /** * Enquiry Table of Operational State Cluster and alias Cluter Delegate corresponding to endpointId and clusterId * Note: User Define @@ -89,6 +112,7 @@ static OperationalStateDelegate opStateDelegate(to_underlying(OperationalStateEn constexpr DelegatesEnquiryTable kDelegatesEnquiryTable[] = { // EndpointId, ClusterId, Delegate { Clusters::OperationalState::kDemoEndpointId, Clusters::OperationalState::Id, &opStateDelegate }, + { Clusters::OperationalState::kDemoEndpointId, Clusters::RvcOperationalState::Id, &rvcOpStateDelegate }, }; /** @@ -130,4 +154,8 @@ void MatterOperationalStateServerInit() static Clusters::OperationalState::OperationalStateServer operationalstateServer(Clusters::OperationalState::kDemoEndpointId, Clusters::OperationalState::Id); operationalstateServer.Init(); + + static Clusters::OperationalState::OperationalStateServer rvcOperationalstateServer(Clusters::OperationalState::kDemoEndpointId, + Clusters::RvcOperationalState::Id); + rvcOperationalstateServer.Init(); } diff --git a/src/app/common/templates/config-data.yaml b/src/app/common/templates/config-data.yaml index d31acdb01ce998..0e19b31138f27c 100644 --- a/src/app/common/templates/config-data.yaml +++ b/src/app/common/templates/config-data.yaml @@ -32,6 +32,7 @@ CommandHandlerInterfaceOnlyClusters: - OperationalState - ActivatedCarbonFilterMonitoring - HepaFilterMonitoring + - RvcOperationalState # We need a more configurable way of deciding which clusters have which init functions.... # See https://github.com/project-chip/connectedhomeip/issues/4369 diff --git a/src/app/tests/suites/TestRVCOperationalState.yaml b/src/app/tests/suites/TestRVCOperationalState.yaml new file mode 100644 index 00000000000000..3a52d89fb7ad00 --- /dev/null +++ b/src/app/tests/suites/TestRVCOperationalState.yaml @@ -0,0 +1,122 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: RVC Operational State Tests + +config: + nodeId: 0x12344321 + cluster: "RVC Operational State" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read Phase List" + command: "readAttribute" + attribute: "PhaseList" + response: + value: null + + - label: "Read current Phase" + command: "readAttribute" + attribute: "CurrentPhase" + response: + value: null + + - label: "Read Countdown Time" + command: "readAttribute" + attribute: "CountdownTime" + response: + value: null + + - label: "Read Operational State List" + command: "readAttribute" + attribute: "OperationalStateList" + response: + value: + [ + { OperationalStateID: 0 }, + { OperationalStateID: 1 }, + { OperationalStateID: 2 }, + { OperationalStateID: 3 }, + { OperationalStateID: 64 }, + { OperationalStateID: 65 }, + { OperationalStateID: 66 }, + ] + + - label: "Read current Operational Error" + command: "readAttribute" + attribute: "OperationalError" + response: + value: { ErrorStateID: 0 } + + - label: "Read current Operational State" + command: "readAttribute" + attribute: "OperationalState" + response: + value: 0 + + - label: "Start Command" + command: "Start" + response: + error: UNSUPPORTED_COMMAND + + - label: "Read current Operational State" + command: "readAttribute" + attribute: "OperationalState" + response: + value: 0 + + - label: "Pause Command" + command: "Pause" + response: + values: + - name: "CommandResponseState" + value: { ErrorStateID: 0 } + + - label: "Read current Operational State" + command: "readAttribute" + attribute: "OperationalState" + response: + value: 2 + + - label: "Resume Command" + command: "Resume" + response: + values: + - name: "CommandResponseState" + value: { ErrorStateID: 0 } + + - label: "Read current Operational State" + command: "readAttribute" + attribute: "OperationalState" + response: + value: 1 + + - label: "Stop Command" + command: "Stop" + response: + error: UNSUPPORTED_COMMAND + + - label: "Read current Operational State" + command: "readAttribute" + attribute: "OperationalState" + response: + value: 1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 23f55962015daa..8c7b97bb7463a1 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -259,7 +259,8 @@ "TestCommissioningWindow", "TestCommissionerNodeId", "TestTimeSynchronization", - "TestOperationalState" + "TestOperationalState", + "TestRVCOperationalState" ], "MultiAdmin": ["TestMultiAdmin"], "SoftwareDiagnostics": ["Test_TC_DGSW_1_1"], diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index 8e42e4e277ab30..116ed030cd751c 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -155,6 +155,7 @@ void MatterDishwasherModePluginServerInitCallback() {} void MatterLaundryWasherModePluginServerInitCallback() {} void MatterRefrigeratorAndTemperatureControlledCabinetModePluginServerInitCallback() {} void MatterOperationalStatePluginServerInitCallback() {} +void MatterRvcOperationalStatePluginServerInitCallback() {} // **************************************** // Print out information about each cluster // **************************************** diff --git a/src/app/zap_cluster_list.json b/src/app/zap_cluster_list.json index 4c3b0ff941ce3e..e405b924737a7d 100644 --- a/src/app/zap_cluster_list.json +++ b/src/app/zap_cluster_list.json @@ -183,6 +183,7 @@ "ON_OFF_SWITCH_CONFIGURATION_CLUSTER": [], "OPERATIONAL_CREDENTIALS_CLUSTER": ["operational-credentials-server"], "OPERATIONAL_STATE_CLUSTER": ["operational-state-server"], + "OPERATIONAL_STATE_RVC_CLUSTER": ["operational-state-server"], "OTA_BOOTLOAD_CLUSTER": [], "OTA_SOFTWARE_UPDATE_PROVIDER_CLUSTER": ["ota-provider"], "OTA_SOFTWARE_UPDATE_REQUESTOR_CLUSTER": ["ota-requestor"], diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index 3a0809697a120f..6a8b1b36982539 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -8765,30 +8765,6 @@ bool emberAfDishwasherAlarmClusterResetCallback( bool emberAfDishwasherAlarmClusterModifyEnabledAlarmsCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::DishwasherAlarm::Commands::ModifyEnabledAlarms::DecodableType & commandData); -/** - * @brief RVC Operational State Cluster Pause Command callback (from client) - */ -bool emberAfRvcOperationalStateClusterPauseCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::RvcOperationalState::Commands::Pause::DecodableType & commandData); -/** - * @brief RVC Operational State Cluster Stop Command callback (from client) - */ -bool emberAfRvcOperationalStateClusterStopCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::RvcOperationalState::Commands::Stop::DecodableType & commandData); -/** - * @brief RVC Operational State Cluster Start Command callback (from client) - */ -bool emberAfRvcOperationalStateClusterStartCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::RvcOperationalState::Commands::Start::DecodableType & commandData); -/** - * @brief RVC Operational State Cluster Resume Command callback (from client) - */ -bool emberAfRvcOperationalStateClusterResumeCallback( - chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::RvcOperationalState::Commands::Resume::DecodableType & commandData); /** * @brief Door Lock Cluster LockDoor Command callback (from client) */ diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index bf8de99c1928d7..2f4f24d5404310 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -290,6 +290,7 @@ class TestList : public Command printf("TestCommissionerNodeId\n"); printf("TestTimeSynchronization\n"); printf("TestOperationalState\n"); + printf("TestRVCOperationalState\n"); printf("TestMultiAdmin\n"); printf("Test_TC_DGSW_1_1\n"); printf("TestSubscribe_OnOff\n"); @@ -91555,6 +91556,288 @@ class TestOperationalStateSuite : public TestCommand } }; +class TestRVCOperationalStateSuite : public TestCommand +{ +public: + TestRVCOperationalStateSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestRVCOperationalState", 15, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~TestRVCOperationalStateSuite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable> value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("phaseList", value)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("currentPhase", value)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValueNull("countdownTime", value)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::RvcOperationalState::Structs::OperationalStateStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 0)); + VerifyOrReturn( + CheckValue("operationalStateList[0].operationalStateID", iter_0.GetValue().operationalStateID, 0U)); + VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 1)); + VerifyOrReturn( + CheckValue("operationalStateList[1].operationalStateID", iter_0.GetValue().operationalStateID, 1U)); + VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 2)); + VerifyOrReturn( + CheckValue("operationalStateList[2].operationalStateID", iter_0.GetValue().operationalStateID, 2U)); + VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 3)); + VerifyOrReturn( + CheckValue("operationalStateList[3].operationalStateID", iter_0.GetValue().operationalStateID, 3U)); + VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 4)); + VerifyOrReturn( + CheckValue("operationalStateList[4].operationalStateID", iter_0.GetValue().operationalStateID, 64U)); + VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 5)); + VerifyOrReturn( + CheckValue("operationalStateList[5].operationalStateID", iter_0.GetValue().operationalStateID, 65U)); + VerifyOrReturn(CheckNextListItemDecodes("operationalStateList", iter_0, 6)); + VerifyOrReturn( + CheckValue("operationalStateList[6].operationalStateID", iter_0.GetValue().operationalStateID, 66U)); + VerifyOrReturn(CheckNoMoreListItems("operationalStateList", iter_0, 7)); + } + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::RvcOperationalState::Structs::ErrorStateStruct::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalError.errorStateID", value.errorStateID, 0U)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalState", value, 0U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalState", value, 0U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("commandResponseState.errorStateID", value.commandResponseState.errorStateID, 0U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalState", value, 2U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::DecodableType value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("commandResponseState.errorStateID", value.commandResponseState.errorStateID, 0U)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalState", value, 1U)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("operationalState", value, 1U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read Phase List"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::PhaseList::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read current Phase"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::CurrentPhase::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Read Countdown Time"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::CountdownTime::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Read Operational State List"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::OperationalStateList::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read current Operational Error"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::OperationalError::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read current Operational State"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Start Command"); + ListFreer listFreer; + chip::app::Clusters::RvcOperationalState::Commands::Start::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, RvcOperationalState::Commands::Start::Id, + value, chip::NullOptional + + ); + } + case 8: { + LogStep(8, "Read current Operational State"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Pause Command"); + ListFreer listFreer; + chip::app::Clusters::RvcOperationalState::Commands::Pause::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, RvcOperationalState::Commands::Pause::Id, + value, chip::NullOptional + + ); + } + case 10: { + LogStep(10, "Read current Operational State"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Resume Command"); + ListFreer listFreer; + chip::app::Clusters::RvcOperationalState::Commands::Resume::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, RvcOperationalState::Commands::Resume::Id, + value, chip::NullOptional + + ); + } + case 12: { + LogStep(12, "Read current Operational State"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Stop Command"); + ListFreer listFreer; + chip::app::Clusters::RvcOperationalState::Commands::Stop::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, RvcOperationalState::Commands::Stop::Id, + value, chip::NullOptional + + ); + } + case 14: { + LogStep(14, "Read current Operational State"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RvcOperationalState::Id, + RvcOperationalState::Attributes::OperationalState::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + class TestMultiAdminSuite : public TestCommand { public: @@ -135103,6 +135386,7 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 12446940281088..4ee46edb2c805b 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -265,6 +265,7 @@ class TestList : public Command { printf("TestCommissionerNodeId\n"); printf("TestTimeSynchronization\n"); printf("TestOperationalState\n"); + printf("TestRVCOperationalState\n"); printf("TestMultiAdmin\n"); printf("Test_TC_DGSW_1_1\n"); printf("TestSubscribe_OnOff\n"); @@ -142462,6 +142463,553 @@ class TestOperationalState : public TestCommandBridge { } }; +class TestRVCOperationalState : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + TestRVCOperationalState() + : TestCommandBridge("TestRVCOperationalState") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~TestRVCOperationalState() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: TestRVCOperationalState\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: TestRVCOperationalState\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read Phase List\n"); + err = TestReadPhaseList_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read current Phase\n"); + err = TestReadCurrentPhase_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read Countdown Time\n"); + err = TestReadCountdownTime_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read Operational State List\n"); + err = TestReadOperationalStateList_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read current Operational Error\n"); + err = TestReadCurrentOperationalError_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read current Operational State\n"); + err = TestReadCurrentOperationalState_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Start Command\n"); + err = TestStartCommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read current Operational State\n"); + err = TestReadCurrentOperationalState_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Pause Command\n"); + err = TestPauseCommand_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read current Operational State\n"); + err = TestReadCurrentOperationalState_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Resume Command\n"); + err = TestResumeCommand_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read current Operational State\n"); + err = TestReadCurrentOperationalState_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Stop Command\n"); + err = TestStopCommand_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read current Operational State\n"); + err = TestReadCurrentOperationalState_14(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 15; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadPhaseList_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePhaseListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read Phase List Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNull("PhaseList", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentPhase_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentPhaseWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read current Phase Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNull("CurrentPhase", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCountdownTime_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCountdownTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read Countdown Time Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNull("CountdownTime", actualValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOperationalStateList_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOperationalStateListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read Operational State List Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OperationalStateList", [actualValue count], static_cast(7))); + VerifyOrReturn(CheckValue("OperationalStateID", + ((MTRRVCOperationalStateClusterOperationalStateStruct *) actualValue[0]).operationalStateID, 0U)); + VerifyOrReturn(CheckValue("OperationalStateID", + ((MTRRVCOperationalStateClusterOperationalStateStruct *) actualValue[1]).operationalStateID, 1U)); + VerifyOrReturn(CheckValue("OperationalStateID", + ((MTRRVCOperationalStateClusterOperationalStateStruct *) actualValue[2]).operationalStateID, 2U)); + VerifyOrReturn(CheckValue("OperationalStateID", + ((MTRRVCOperationalStateClusterOperationalStateStruct *) actualValue[3]).operationalStateID, 3U)); + VerifyOrReturn(CheckValue("OperationalStateID", + ((MTRRVCOperationalStateClusterOperationalStateStruct *) actualValue[4]).operationalStateID, 64U)); + VerifyOrReturn(CheckValue("OperationalStateID", + ((MTRRVCOperationalStateClusterOperationalStateStruct *) actualValue[5]).operationalStateID, 65U)); + VerifyOrReturn(CheckValue("OperationalStateID", + ((MTRRVCOperationalStateClusterOperationalStateStruct *) actualValue[6]).operationalStateID, 66U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentOperationalError_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOperationalErrorWithCompletion:^( + MTRRVCOperationalStateClusterErrorStateStruct * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read current Operational Error Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn( + CheckValue("ErrorStateID", ((MTRRVCOperationalStateClusterErrorStateStruct *) actualValue).errorStateID, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentOperationalState_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOperationalStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read current Operational State Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OperationalState", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStartCommand_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster startWithCompletion:^( + MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Start Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentOperationalState_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOperationalStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read current Operational State Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OperationalState", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestPauseCommand_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster pauseWithCompletion:^( + MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Pause Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.commandResponseState; + VerifyOrReturn( + CheckValue("ErrorStateID", ((MTRRVCOperationalStateClusterErrorStateStruct *) actualValue).errorStateID, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentOperationalState_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOperationalStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read current Operational State Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OperationalState", actualValue, 2U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestResumeCommand_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster resumeWithCompletion:^( + MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Resume Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.commandResponseState; + VerifyOrReturn( + CheckValue("ErrorStateID", ((MTRRVCOperationalStateClusterErrorStateStruct *) actualValue).errorStateID, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentOperationalState_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOperationalStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read current Operational State Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OperationalState", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStopCommand_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster stopWithCompletion:^( + MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable err) { + NSLog(@"Stop Command Error: %@", err); + + VerifyOrReturn(CheckValue("status", + err ? ([err.domain isEqualToString:MTRInteractionErrorDomain] ? err.code : EMBER_ZCL_STATUS_FAILURE) : 0, + EMBER_ZCL_STATUS_UNSUPPORTED_COMMAND)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadCurrentOperationalState_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOperationalStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read current Operational State Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OperationalState", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class TestMultiAdmin : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -173173,6 +173721,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),