diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index 83adb93e91fffc..597af3c96270d8 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -35,17 +35,13 @@ "Test_TC_BINFO_2_2", "Test_TC_ACL_2_5", "Test_TC_ACL_2_6", + "Test_TC_SMOKECO_2_2", + "Test_TC_SMOKECO_2_3", + "Test_TC_SMOKECO_2_4", + "Test_TC_SMOKECO_2_5", "Disabled because the power source configuration cluster is now deprecated and not present in all-clusters", "Test_TC_PSCFG_1_1", "Test_TC_PSCFG_2_1", - "Test_TC_PSCFG_2_2", - "Disabled due to SmokeCOAlarm not being enabled in Matter.framework for now:", - "Test_TC_SMCO_1_1", - "Test_TC_SMCO_2_1", - "Test_TC_SMCO_2_2", - "Test_TC_SMCO_2_3", - "Test_TC_SMCO_2_4", - "Test_TC_SMCO_2_5", - "Test_TC_SMCO_2_6" + "Test_TC_PSCFG_2_2" ] } diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index 26aed1ddc34138..2b761d95684baf 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -143,11 +143,11 @@ def _GetInDevelopmentTests() -> Set[str]: "Test_TC_PSCFG_1_1.yaml", # Power source configuration cluster is deprecated and removed from all-clusters "Test_TC_PSCFG_2_1.yaml", # Power source configuration cluster is deprecated and removed from all-clusters "Test_TC_PSCFG_2_2.yaml", # Power source configuration cluster is deprecated and removed from all-clusters - "Test_TC_SMCO_2_2.yaml", # chip-repl does not support timeout (07/20/2023) - "Test_TC_SMCO_2_3.yaml", # chip-repl does not support timeout (07/20/2023) - "Test_TC_SMCO_2_4.yaml", # chip-repl does not support timeout (07/20/2023) - "Test_TC_SMCO_2_5.yaml", # chip-repl does not support timeout (07/20/2023) - "Test_TC_SMCO_2_6.yaml", # chip-repl does not support timeout (07/20/2023) + "Test_TC_SMOKECO_2_2.yaml", # chip-repl does not support local timeout (07/20/2023) + "Test_TC_SMOKECO_2_3.yaml", # chip-repl does not support local timeout (07/20/2023) + "Test_TC_SMOKECO_2_4.yaml", # chip-repl does not support local timeout (07/20/2023) + "Test_TC_SMOKECO_2_5.yaml", # chip-repl does not support local timeout (07/20/2023) + "Test_TC_SMOKECO_2_6.yaml", # chip-repl does not support local timeout (07/20/2023) "Test_TC_IDM_1_2.yaml", # chip-repl does not support AnyCommands (19/07/2023) } diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 80bb8f62da70f7..d42e181b430c28 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -9375,107 +9375,107 @@ PICS: id: OPSTATE.S.C04.Tx # Smoke CO Alarm Cluster Test Plan - - label: "Does the device implement the SMCO cluster as a server?" - id: SMCO.S + - label: "Does the device implement the SMOKECO cluster as a server?" + id: SMOKECO.S - - label: "Does the device implement the SMCO cluster as a client?" - id: SMCO.C + - label: "Does the device implement the SMOKECO cluster as a client?" + id: SMOKECO.C # # server / features # - label: "Does the device support this specific cluster feature?" - id: SMCO.S.F00 + id: SMOKECO.S.F00 - label: "Does the device support this specific cluster feature?" - id: SMCO.S.F01 + id: SMOKECO.S.F01 # # server / attributes # - label: "Does the device implement the ExpressedState attribute?" - id: SMCO.S.A0000 + id: SMOKECO.S.A0000 - label: "Does the device implement the SmokeState attribute?" - id: SMCO.S.A0001 + id: SMOKECO.S.A0001 - label: "Does the device implement the COState attribute?" - id: SMCO.S.A0002 + id: SMOKECO.S.A0002 - label: "Does the device implement the BatteryAlert attribute?" - id: SMCO.S.A0003 + id: SMOKECO.S.A0003 - label: "Does the device implement the DeviceMuted attribute?" - id: SMCO.S.A0004 + id: SMOKECO.S.A0004 - label: "Does the device implement the TestInProgress attribute?" - id: SMCO.S.A0005 + id: SMOKECO.S.A0005 - label: "Does the device implement the HardwareFaultAlert attribute?" - id: SMCO.S.A0006 + id: SMOKECO.S.A0006 - label: "Does the device implement the EndOfServiceAlert attribute?" - id: SMCO.S.A0007 + id: SMOKECO.S.A0007 - label: "Does the device implement the InterconnectSmokeAlarm attribute?" - id: SMCO.S.A0008 + id: SMOKECO.S.A0008 - label: "Does the device implement the InterconnectCOAlarm attribute?" - id: SMCO.S.A0009 + id: SMOKECO.S.A0009 - label: "Does the device implement the ContaminationState attribute?" - id: SMCO.S.A0010 + id: SMOKECO.S.A0010 - label: "Does the device implement the SensitivityLevel attribute?" - id: SMCO.S.A0011 + id: SMOKECO.S.A0011 - label: "Does the device implement the ExpiryDate attribute?" - id: SMCO.S.A0012 + id: SMOKECO.S.A0012 - label: "Does the device implement the ContaminationState attribute?" - id: SMCO.S.A000a + id: SMOKECO.S.A000a - label: "Does the device implement the SensitivityLevel attribute?" - id: SMCO.S.A000b + id: SMOKECO.S.A000b - label: "Does the device implement the ExpiryDate attribute?" - id: SMCO.S.A000c + id: SMOKECO.S.A000c # # server / Events # - label: "Does the device implement the SmokeAlarm event?" - id: SMCO.S.E00 + id: SMOKECO.S.E00 - label: "Does the device implement the COAlarm event?" - id: SMCO.S.E01 + id: SMOKECO.S.E01 - label: "Does the device implement the LowBattery event?" - id: SMCO.S.E02 + id: SMOKECO.S.E02 - label: "Does the device implement the HardwareFault event?" - id: SMCO.S.E03 + id: SMOKECO.S.E03 - label: "Does the device implement the EndOfService event?" - id: SMCO.S.E04 + id: SMOKECO.S.E04 - label: "Does the device implement the SelfTestComplete event?" - id: SMCO.S.E05 + id: SMOKECO.S.E05 - label: "Does the device implement the AlarmMuted event?" - id: SMCO.S.E06 + id: SMOKECO.S.E06 - label: "Does the device implement the MuteEnded event?" - id: SMCO.S.E07 + id: SMOKECO.S.E07 - label: "Does the device implement the InterconnectSmokeAlarm event?" - id: SMCO.S.E08 + id: SMOKECO.S.E08 - label: "Does the device implement the InterconnectCOAlarm event?" - id: SMCO.S.E09 + id: SMOKECO.S.E09 - label: "Does the device implement the AllClear event?" - id: SMCO.S.E10 + id: SMOKECO.S.E10 # # server / manually @@ -9483,18 +9483,18 @@ PICS: - label: "Can the TestInProgress attribute be changed by physical control at the device?" - id: SMCO.M.ManuallyControlledTest + id: SMOKECO.M.ManuallyControlledTest - label: "Can the DeviceMuted attribute be changed by physical control at the device?" - id: SMCO.M.ManuallyControlledMute + id: SMOKECO.M.ManuallyControlledMute # # server / commandsReceived # - label: "Does the device implement receiving the SelfTestRequest command?" - id: SMCO.S.C00.Rsp + id: SMOKECO.S.C00.Rsp # Laundry Washer Mode Cluster diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_1_1.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_1_1.yaml similarity index 99% rename from src/app/tests/suites/certification/Test_TC_SMCO_1_1.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_1_1.yaml index 07730f59f0e57d..9e19aa2e4228a5 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_1_1.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 4.1.1. [TC-SMCO-1.1] Global Attributes with DUT as Server +name: 4.1.1. [TC-SMOKECO-1.1] Global Attributes with DUT as Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_1.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_1.yaml similarity index 98% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_1.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_1.yaml index 5eeb7084800ab7..5959a3d6da1dc5 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_1.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 4.2.1. [TC-SMCO-2.1] Attributes with DUT as Server +name: 4.2.1. [TC-SMOKECO-2.1] Attributes with DUT as Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_2.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_2.yaml similarity index 98% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_2.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_2.yaml index a36cb1a46944cf..0e44017c4df7ec 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_2.yaml @@ -13,7 +13,8 @@ # limitations under the License. name: - 4.2.2. [TC-SMCO-2.2] Primary Functionality - Smoke Alarm with DUT as Server + 4.2.2. [TC-SMOKECO-2.2] Primary Functionality - Smoke Alarm with DUT as + Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_3.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_3.yaml similarity index 98% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_3.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_3.yaml index 96d3f41e2047d8..eed913616c10cd 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_3.yaml @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 4.2.3. [TC-SMCO-2.3] Primary Functionality - CO Alarm with DUT as Server +name: + 4.2.3. [TC-SMOKECO-2.3] Primary Functionality - CO Alarm with DUT as Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_4.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_4.yaml similarity index 99% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_4.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_4.yaml index 353826179b1d74..5326a83d5fe16b 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_4.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_4.yaml @@ -13,7 +13,8 @@ # limitations under the License. name: - 4.2.4. [TC-SMCO-2.4] Secondary Functionality - Mandatory with DUT as Server + 4.2.4. [TC-SMOKECO-2.4] Secondary Functionality - Mandatory with DUT as + Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_5.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_5.yaml similarity index 99% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_5.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_5.yaml index edb7e6d8cf3021..3607665b0c8f46 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_5.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_5.yaml @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 4.2.5. [TC-SMCO-2.5] Secondary Functionality - Optional with DUT as Server +name: + 4.2.5. [TC-SMOKECO-2.5] Secondary Functionality - Optional with DUT as + Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_6.yaml similarity index 98% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_6.yaml index 0b13078763c4cb..6aba1c9adf70da 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_6.yaml @@ -13,8 +13,8 @@ # limitations under the License. name: - 4.2.6. [TC-SMCO-2.6] ExpressedState Attribute - Multiple Alarms with DUT as - Server + 4.2.6. [TC-SMOKECO-2.6] ExpressedState Attribute - Multiple Alarms with DUT + as Server PICS: - SMOKECO.S @@ -195,7 +195,7 @@ tests: PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event" - PICS: DGGEN.S.C00.Rsp + PICS: SMOKECO.S.A0008 && DGGEN.S.C00.Rsp cluster: "General Diagnostics" endpoint: 0 command: "TestEventTrigger" @@ -224,7 +224,7 @@ tests: Endpoint 0 with EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event" - PICS: DGGEN.S.C00.Rsp + PICS: SMOKECO.S.A0009 && DGGEN.S.C00.Rsp cluster: "General Diagnostics" endpoint: 0 command: "TestEventTrigger" @@ -393,7 +393,7 @@ tests: PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event Clear" - PICS: DGGEN.S.C00.Rsp + PICS: SMOKECO.S.A0009 && DGGEN.S.C00.Rsp cluster: "General Diagnostics" endpoint: 0 command: "TestEventTrigger" @@ -431,7 +431,7 @@ tests: PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event Clear" - PICS: DGGEN.S.C00.Rsp + PICS: SMOKECO.S.A0008 && DGGEN.S.C00.Rsp cluster: "General Diagnostics" endpoint: 0 command: "TestEventTrigger" diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index fec8d2be4b5d1d..e1ed9239dd0752 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2751,40 +2751,40 @@ RVCCLEANMS.S.C01.Rsp=1 RVCCLEANMS.S.C03.Tx=1 # Smoke CO Alarm Cluster -SMCO.S=1 -SMCO.S.F00=1 -SMCO.S.F01=1 -SMCO.S.A0000=1 -SMCO.S.A0001=1 -SMCO.S.A0002=1 -SMCO.S.A0003=1 -SMCO.S.A0004=1 -SMCO.S.A0005=1 -SMCO.S.A0006=1 -SMCO.S.A0007=1 -SMCO.S.A0008=1 -SMCO.S.A0009=1 -SMCO.S.A0010=1 -SMCO.S.A0011=1 -SMCO.S.A0012=1 -SMCO.S.A000a=1 -SMCO.S.A000b=1 -SMCO.S.A000c=1 -SMCO.S.E00=1 -SMCO.S.E01=1 -SMCO.S.E02=1 -SMCO.S.E03=1 -SMCO.S.E04=1 -SMCO.S.E05=1 -SMCO.S.E06=1 -SMCO.S.E07=1 -SMCO.S.E08=1 -SMCO.S.E09=1 -SMCO.S.E10=1 -SMCO.M.ManuallyControlledTest=1 -SMCO.M.ManuallyControlledMute=1 -SMCO.S.C00.Rsp=1 -SMCO.C=1 +SMOKECO.S=1 +SMOKECO.S.F00=1 +SMOKECO.S.F01=1 +SMOKECO.S.A0000=1 +SMOKECO.S.A0001=1 +SMOKECO.S.A0002=1 +SMOKECO.S.A0003=1 +SMOKECO.S.A0004=1 +SMOKECO.S.A0005=1 +SMOKECO.S.A0006=1 +SMOKECO.S.A0007=1 +SMOKECO.S.A0008=1 +SMOKECO.S.A0009=1 +SMOKECO.S.A0010=1 +SMOKECO.S.A0011=1 +SMOKECO.S.A0012=1 +SMOKECO.S.A000a=1 +SMOKECO.S.A000b=1 +SMOKECO.S.A000c=1 +SMOKECO.S.E00=1 +SMOKECO.S.E01=1 +SMOKECO.S.E02=1 +SMOKECO.S.E03=1 +SMOKECO.S.E04=1 +SMOKECO.S.E05=1 +SMOKECO.S.E06=1 +SMOKECO.S.E07=1 +SMOKECO.S.E08=1 +SMOKECO.S.E09=1 +SMOKECO.S.E10=1 +SMOKECO.M.ManuallyControlledTest=1 +SMOKECO.M.ManuallyControlledMute=1 +SMOKECO.S.C00.Rsp=1 +SMOKECO.C=1 #Temperature Controlled Cabinet Mode Cluster TCCM.S=1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index a22aea164ddc76..7db3d988af0d3b 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -178,13 +178,13 @@ "RelativeHumidityMeasurement": ["Test_TC_RH_1_1", "Test_TC_RH_2_1"], "SecureChannel": [], "SmokeCOAlarm": [ - "Test_TC_SMCO_1_1", - "Test_TC_SMCO_2_1", - "Test_TC_SMCO_2_2", - "Test_TC_SMCO_2_3", - "Test_TC_SMCO_2_4", - "Test_TC_SMCO_2_5", - "Test_TC_SMCO_2_6" + "Test_TC_SMOKECO_1_1", + "Test_TC_SMOKECO_2_1", + "Test_TC_SMOKECO_2_2", + "Test_TC_SMOKECO_2_3", + "Test_TC_SMOKECO_2_4", + "Test_TC_SMOKECO_2_5", + "Test_TC_SMOKECO_2_6" ], "Switch": ["Test_TC_SWTCH_1_1", "Test_TC_SWTCH_2_1"], "TemperatureMeasurement": ["Test_TC_TMP_1_1", "Test_TC_TMP_2_1"], diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index a07a8e2609fed0..94784a6ee76f92 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -209,13 +209,13 @@ class TestList : public Command printf("Test_TC_PSCFG_2_1\n"); printf("Test_TC_RH_1_1\n"); printf("Test_TC_RH_2_1\n"); - printf("Test_TC_SMCO_1_1\n"); - printf("Test_TC_SMCO_2_1\n"); - printf("Test_TC_SMCO_2_2\n"); - printf("Test_TC_SMCO_2_3\n"); - printf("Test_TC_SMCO_2_4\n"); - printf("Test_TC_SMCO_2_5\n"); - printf("Test_TC_SMCO_2_6\n"); + printf("Test_TC_SMOKECO_1_1\n"); + printf("Test_TC_SMOKECO_2_1\n"); + printf("Test_TC_SMOKECO_2_2\n"); + printf("Test_TC_SMOKECO_2_3\n"); + printf("Test_TC_SMOKECO_2_4\n"); + printf("Test_TC_SMOKECO_2_5\n"); + printf("Test_TC_SMOKECO_2_6\n"); printf("Test_TC_SWTCH_1_1\n"); printf("Test_TC_SWTCH_2_1\n"); printf("Test_TC_TMP_1_1\n"); @@ -59243,10 +59243,11 @@ class Test_TC_RH_2_1Suite : public TestCommand } }; -class Test_TC_SMCO_1_1Suite : public TestCommand +class Test_TC_SMOKECO_1_1Suite : public TestCommand { public: - Test_TC_SMCO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_1_1", 25, credsIssuerConfig) + Test_TC_SMOKECO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_1_1", 25, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -59254,7 +59255,7 @@ class Test_TC_SMCO_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_SMCO_1_1Suite() {} + ~Test_TC_SMOKECO_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -59680,10 +59681,11 @@ class Test_TC_SMCO_1_1Suite : public TestCommand } }; -class Test_TC_SMCO_2_1Suite : public TestCommand +class Test_TC_SMOKECO_2_1Suite : public TestCommand { public: - Test_TC_SMCO_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_1", 14, credsIssuerConfig) + Test_TC_SMOKECO_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_1", 14, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -59691,7 +59693,7 @@ class Test_TC_SMCO_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_SMCO_2_1Suite() {} + ~Test_TC_SMOKECO_2_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -59949,10 +59951,11 @@ class Test_TC_SMCO_2_1Suite : public TestCommand } }; -class Test_TC_SMCO_2_2Suite : public TestCommand +class Test_TC_SMOKECO_2_2Suite : public TestCommand { public: - Test_TC_SMCO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_2", 20, credsIssuerConfig) + Test_TC_SMOKECO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_2", 20, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -59965,7 +59968,7 @@ class Test_TC_SMCO_2_2Suite : public TestCommand AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); } - ~Test_TC_SMCO_2_2Suite() {} + ~Test_TC_SMOKECO_2_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(990)); } @@ -60352,10 +60355,11 @@ class Test_TC_SMCO_2_2Suite : public TestCommand } }; -class Test_TC_SMCO_2_3Suite : public TestCommand +class Test_TC_SMOKECO_2_3Suite : public TestCommand { public: - Test_TC_SMCO_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_3", 20, credsIssuerConfig) + Test_TC_SMOKECO_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_3", 20, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -60368,7 +60372,7 @@ class Test_TC_SMCO_2_3Suite : public TestCommand AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); } - ~Test_TC_SMCO_2_3Suite() {} + ~Test_TC_SMOKECO_2_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(990)); } @@ -60754,10 +60758,11 @@ class Test_TC_SMCO_2_3Suite : public TestCommand } }; -class Test_TC_SMCO_2_4Suite : public TestCommand +class Test_TC_SMOKECO_2_4Suite : public TestCommand { public: - Test_TC_SMCO_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_4", 50, credsIssuerConfig) + Test_TC_SMOKECO_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_4", 50, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -60774,7 +60779,7 @@ class Test_TC_SMCO_2_4Suite : public TestCommand AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); } - ~Test_TC_SMCO_2_4Suite() {} + ~Test_TC_SMOKECO_2_4Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(2910)); } @@ -61713,10 +61718,11 @@ class Test_TC_SMCO_2_4Suite : public TestCommand } }; -class Test_TC_SMCO_2_5Suite : public TestCommand +class Test_TC_SMOKECO_2_5Suite : public TestCommand { public: - Test_TC_SMCO_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_5", 75, credsIssuerConfig) + Test_TC_SMOKECO_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_5", 75, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -61745,7 +61751,7 @@ class Test_TC_SMCO_2_5Suite : public TestCommand AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); } - ~Test_TC_SMCO_2_5Suite() {} + ~Test_TC_SMOKECO_2_5Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(6090)); } @@ -63204,10 +63210,11 @@ class Test_TC_SMCO_2_5Suite : public TestCommand } }; -class Test_TC_SMCO_2_6Suite : public TestCommand +class Test_TC_SMOKECO_2_6Suite : public TestCommand { public: - Test_TC_SMCO_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_6", 34, credsIssuerConfig) + Test_TC_SMOKECO_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_6", 34, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -63232,7 +63239,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand AddArgument("HIEST_PRI_ALARM_5", 0, UINT8_MAX, &mHiestPriAlarm5); } - ~Test_TC_SMCO_2_6Suite() {} + ~Test_TC_SMOKECO_2_6Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(3090)); } @@ -63620,7 +63627,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " "Interconnect Smoke Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; value.enableKey = mTestEventTriggerKey.HasValue() @@ -63645,7 +63652,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " "Interconnect CO Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; value.enableKey = mTestEventTriggerKey.HasValue() @@ -63783,7 +63790,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " "Interconnect CO Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; value.enableKey = mTestEventTriggerKey.HasValue() @@ -63814,7 +63821,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " "Interconnect Smoke Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; value.enableKey = mTestEventTriggerKey.HasValue() @@ -145073,13 +145080,13 @@ 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), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + 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 125b3516ffbc3d..22b20b80ff9eb9 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -192,6 +192,9 @@ class TestList : public Command { printf("Test_TC_PCC_2_4\n"); printf("Test_TC_RH_1_1\n"); printf("Test_TC_RH_2_1\n"); + printf("Test_TC_SMOKECO_1_1\n"); + printf("Test_TC_SMOKECO_2_1\n"); + printf("Test_TC_SMOKECO_2_6\n"); printf("Test_TC_SWTCH_1_1\n"); printf("Test_TC_TMP_1_1\n"); printf("Test_TC_TMP_2_1\n"); @@ -87607,6 +87610,2850 @@ class Test_TC_RH_2_1 : public TestCommandBridge { } }; +class Test_TC_SMOKECO_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_SMOKECO_1_1() + : TestCommandBridge("Test_TC_SMOKECO_1_1") + , 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) + + ~Test_TC_SMOKECO_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SMOKECO_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SMOKECO_1_1\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 : Commission DUT to TH\n"); + err = TestCommissionDutToTh_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); + err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the FeatureMap attribute\n"); + if (ShouldSkip("!SMOKECO.S.F00 && !SMOKECO.S.F01")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheFeatureMapAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the FeatureMap attribute(Smoke Alarm)\n"); + if (ShouldSkip("SMOKECO.S.F00 && !SMOKECO.S.F01")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheFeatureMapAttributeSmokeAlarm_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the FeatureMap attribute(CO Alarm)\n"); + if (ShouldSkip("SMOKECO.S.F01 && !SMOKECO.S.F00")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheFeatureMapAttributeCOAlarm_4(); + break; + case 5: + ChipLogProgress( + chipTool, " ***** Test Step 5 : TH reads from the DUT the FeatureMap attribute(Smoke Alarm & CO Alarm)\n"); + if (ShouldSkip("SMOKECO.S.F00 && SMOKECO.S.F01")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheFeatureMapAttributeSmokeAlarmCoAlarm_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AttributeList attribute\n"); + err = TestThReadsFromTheDutTheAttributeListAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AttributeList attribute(SmokeState)\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeSmokeState_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the AttributeList attribute(COState)\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeCOState_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the AttributeList attribute(DeviceMuted)\n"); + if (ShouldSkip("SMOKECO.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeDeviceMuted_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : TH reads from the DUT the AttributeList attribute(InterconnectSmokeAlarm)\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeInterconnectSmokeAlarm_10(); + break; + case 11: + ChipLogProgress( + chipTool, " ***** Test Step 11 : TH reads from the DUT the AttributeList attribute(InterconnectCOAlarm)\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeInterconnectCOAlarm_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : TH reads from the DUT the AttributeList attribute(ContaminationState)\n"); + if (ShouldSkip("SMOKECO.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeContaminationState_12(); + break; + case 13: + ChipLogProgress( + chipTool, " ***** Test Step 13 : TH reads from the DUT the AttributeList attribute(SmokeSensitivityLevel)\n"); + if (ShouldSkip("SMOKECO.S.A000b")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeSmokeSensitivityLevel_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : TH reads from the DUT the AttributeList attribute(ExpiryDate)\n"); + if (ShouldSkip("SMOKECO.S.A000c")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeExpiryDate_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : TH reads from the DUT the EventList attribute\n"); + NextTest(); + return; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : TH reads from the DUT the EventList attribute(SmokeAlarm)\n"); + if (ShouldSkip("SMOKECO.S.E00")) { + NextTest(); + return; + } + NextTest(); + return; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : TH reads from the DUT the EventList attribute(COAlarm)\n"); + if (ShouldSkip("SMOKECO.S.E01")) { + NextTest(); + return; + } + NextTest(); + return; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : TH reads from the DUT the EventList attribute(AlarmMuted)\n"); + if (ShouldSkip("SMOKECO.S.E06")) { + NextTest(); + return; + } + NextTest(); + return; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : TH reads from the DUT the EventList attribute(MuteEnded)\n"); + if (ShouldSkip("SMOKECO.S.E07")) { + NextTest(); + return; + } + NextTest(); + return; + case 20: + ChipLogProgress( + chipTool, " ***** Test Step 20 : TH reads from the DUT the EventList attribute(InterconnectSmokeAlarm)\n"); + if (ShouldSkip("SMOKECO.S.E08")) { + NextTest(); + return; + } + NextTest(); + return; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : TH reads from the DUT the EventList attribute(InterconnectCOAlarm)\n"); + if (ShouldSkip("SMOKECO.S.E09")) { + NextTest(); + return; + } + NextTest(); + return; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : TH reads from the DUT the AcceptedCommandList attribute\n"); + if (ShouldSkip("!SMOKECO.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAcceptedCommandListAttribute_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : TH reads from the DUT the AcceptedCommandList attribute\n"); + if (ShouldSkip("SMOKECO.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAcceptedCommandListAttribute_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : TH reads from the DUT the GeneratedCommandList attribute\n"); + err = TestThReadsFromTheDutTheGeneratedCommandListAttribute_24(); + 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), 0)); + 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), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + 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 = 25; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestCommissionDutToTh_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the ClusterRevision attribute from the DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheFeatureMapAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the FeatureMap attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheFeatureMapAttributeSmokeAlarm_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the FeatureMap attribute(Smoke Alarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 1UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheFeatureMapAttributeCOAlarm_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the FeatureMap attribute(CO Alarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 2UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheFeatureMapAttributeSmokeAlarmCoAlarm_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the FeatureMap attribute(Smoke Alarm & CO Alarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 3UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeSmokeState_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(SmokeState) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeCOState_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(COState) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeDeviceMuted_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(DeviceMuted) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeInterconnectSmokeAlarm_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(InterconnectSmokeAlarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeInterconnectCOAlarm_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(InterconnectCOAlarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeContaminationState_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(ContaminationState) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeSmokeSensitivityLevel_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(SmokeSensitivityLevel) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 11UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeExpiryDate_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(ExpiryDate) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 12UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAcceptedCommandListAttribute_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AcceptedCommandList attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAcceptedCommandListAttribute_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AcceptedCommandList attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheGeneratedCommandListAttribute_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the GeneratedCommandList attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_SMOKECO_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_SMOKECO_2_1() + : TestCommandBridge("Test_TC_SMOKECO_2_1") + , 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) + + ~Test_TC_SMOKECO_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SMOKECO_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SMOKECO_2_1\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 : Commission DUT to TH\n"); + err = TestCommissionDutToTh_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the ExpressedState attribute\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheExpressedStateAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the SmokeState attribute\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheSmokeStateAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the COState attribute\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheCOStateAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the BatteryAlert attribute\n"); + if (ShouldSkip("SMOKECO.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheBatteryAlertAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the DeviceMuted attribute\n"); + if (ShouldSkip("SMOKECO.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDeviceMutedAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the TestInProgress attribute\n"); + if (ShouldSkip("SMOKECO.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheTestInProgressAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the HardwareFaultAlert attribute\n"); + if (ShouldSkip("SMOKECO.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheHardwareFaultAlertAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the EndOfServiceAlert attribute\n"); + if (ShouldSkip("SMOKECO.S.A0007")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheEndOfServiceAlertAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the InterconnectSmokeAlarm attribute\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInterconnectSmokeAlarmAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the InterconnectCOAlarm attribute\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInterconnectCOAlarmAttribute_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads from the DUT the ContaminationState attribute\n"); + if (ShouldSkip("SMOKECO.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheContaminationStateAttribute_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : TH reads from the DUT the SmokeSensitivityLevel attribute\n"); + if (ShouldSkip("SMOKECO.S.A000b")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheSmokeSensitivityLevelAttribute_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : TH reads from the DUT the ExpiryDate attribute\n"); + if (ShouldSkip("SMOKECO.S.A000c")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheExpiryDateAttribute_13(); + 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), 0)); + 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), 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 = 14; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestCommissionDutToTh_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheExpressedStateAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ExpressedState attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("expressedState", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("expressedState", [value unsignedCharValue], 8U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheSmokeStateAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSmokeStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the SmokeState attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("smokeState", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("smokeState", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("smokeState", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheCOStateAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCOStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the COState attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("COState", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("COState", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("COState", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheBatteryAlertAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeBatteryAlertWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the BatteryAlert attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("batteryAlert", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("batteryAlert", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("batteryAlert", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDeviceMutedAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDeviceMutedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DeviceMuted attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("deviceMuted", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("deviceMuted", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("deviceMuted", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheTestInProgressAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeTestInProgressWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the TestInProgress attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("testInProgress", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheHardwareFaultAlertAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeHardwareFaultAlertWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the HardwareFaultAlert attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("hardwareFaultAlert", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheEndOfServiceAlertAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEndOfServiceAlertWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the EndOfServiceAlert attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("endOfServiceAlert", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("endOfServiceAlert", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("endOfServiceAlert", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInterconnectSmokeAlarmAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInterconnectSmokeAlarmWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InterconnectSmokeAlarm attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("interconnectSmokeAlarm", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("interconnectSmokeAlarm", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("interconnectSmokeAlarm", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInterconnectCOAlarmAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInterconnectCOAlarmWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InterconnectCOAlarm attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("interconnectCOAlarm", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("interconnectCOAlarm", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("interconnectCOAlarm", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheContaminationStateAttribute_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeContaminationStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ContaminationState attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("contaminationState", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("contaminationState", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("contaminationState", [value unsignedCharValue], 3U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheSmokeSensitivityLevelAttribute_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSmokeSensitivityLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the SmokeSensitivityLevel attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("smokeSensitivityLevel", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("smokeSensitivityLevel", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("smokeSensitivityLevel", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheExpiryDateAttribute_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpiryDateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ExpiryDate attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("expiryDate", "epoch_s", "epoch_s")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_SMOKECO_2_6 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_SMOKECO_2_6() + : TestCommandBridge("Test_TC_SMOKECO_2_6") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + AddArgument("TEST_EVENT_TRIGGER_KEY", &mTestEventTriggerKey); + AddArgument("TEST_EVENT_TRIGGER_WARNING_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningSmokeAlarm); + AddArgument("TEST_EVENT_TRIGGER_SMOKE_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerSmokeAlarmClear); + AddArgument("TEST_EVENT_TRIGGER_WARNING_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningCoAlarm); + AddArgument("TEST_EVENT_TRIGGER_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerCoAlarmClear); + AddArgument("TEST_EVENT_TRIGGER_WARNING_BATTERY_ALERT", 0, UINT64_MAX, &mTestEventTriggerWarningBatteryAlert); + AddArgument("TEST_EVENT_TRIGGER_BATTERY_ALERT_CLEAR", 0, UINT64_MAX, &mTestEventTriggerBatteryAlertClear); + AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectSmokeAlarm); + AddArgument( + "TEST_EVENT_TRIGGER_INTERCONNECT_SMOKE_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerInterconnectSmokeAlarmClear); + AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarm); + AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarmClear); + AddArgument("HIEST_PRI_ALARM", 0, UINT8_MAX, &mHiestPriAlarm); + AddArgument("HIEST_PRI_ALARM_2", 0, UINT8_MAX, &mHiestPriAlarm2); + AddArgument("HIEST_PRI_ALARM_3", 0, UINT8_MAX, &mHiestPriAlarm3); + AddArgument("HIEST_PRI_ALARM_4", 0, UINT8_MAX, &mHiestPriAlarm4); + AddArgument("HIEST_PRI_ALARM_5", 0, UINT8_MAX, &mHiestPriAlarm5); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_SMOKECO_2_6() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SMOKECO_2_6\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SMOKECO_2_6\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 : Commission DUT to TH\n"); + err = TestCommissionDutToTh_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Report: TH subscribes to BatteryAlert attribute from DUT\n"); + err = TestReportThSubscribesToBatteryAlertAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH subscribes to BatteryAlert attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0003")) { + NextTest(); + return; + } + err = TestThSubscribesToBatteryAlertAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Report: TH subscribes to InterconnectSmokeAlarm attribute from DUT\n"); + err = TestReportThSubscribesToInterconnectSmokeAlarmAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH subscribes to InterconnectSmokeAlarm attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThSubscribesToInterconnectSmokeAlarmAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Report: TH subscribes to InterconnectCOAlarm attribute from DUT\n"); + err = TestReportThSubscribesToInterconnectCOAlarmAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH subscribes to InterconnectCOAlarm attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThSubscribesToInterconnectCOAlarmAttributeFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Report: TH subscribes to COState attribute from DUT\n"); + err = TestReportThSubscribesToCOStateAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH subscribes to COState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThSubscribesToCOStateAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Report: TH subscribes to SmokeState attribute from DUT\n"); + err = TestReportThSubscribesToSmokeStateAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH subscribes to SmokeState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThSubscribesToSmokeStateAttributeFromDut_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster\n"); + if (ShouldSkip("DGGEN.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsTestEventTriggersEnabledAttributeFromGeneralDiagnosticsCluster_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning Battery Alert Test Event\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningBatteryAlertTestEvent_13(); + break; + case 14: + ChipLogProgress(chipTool, + " ***** Test Step 14 : TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0003")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfBatteryAlertAttributeFromDutWithATimeoutOf300Seconds_14(); + break; + case 15: + ChipLogProgress(chipTool, + " ***** Test Step 15 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event\n"); + if (ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectSmokeAlarmTestEvent_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 " + "seconds\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfInterconnectSmokeAlarmAttributeFromDutWithATimeoutOf300Seconds_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event\n"); + if (ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectCoAlarmTestEvent_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 " + "seconds\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfInterconnectCOAlarmAttributeFromDutWithATimeoutOf300Seconds_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning CO Alarm Test Event\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningCoAlarmTestEvent_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : TH waits for a report of COState attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfCOStateAttributeFromDutWithATimeoutOf300Seconds_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning Smoke Alarm Test Event\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningSmokeAlarmTestEvent_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfSmokeStateAttributeFromDutWithATimeoutOf300Seconds_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke Alarm Test Event Clear\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForSmokeAlarmTestEventClear_24(); + break; + case 25: + ChipLogProgress(chipTool, + " ***** Test Step 25 : TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfSmokeStateAttributeFromDutWithATimeoutOf300Seconds_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_26(); + break; + case 27: + ChipLogProgress(chipTool, + " ***** Test Step 27 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for CO Alarm Test Event clear\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForCoAlarmTestEventClear_27(); + break; + case 28: + ChipLogProgress(chipTool, + " ***** Test Step 28 : TH waits for a report of COState attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfCOStateAttributeFromDutWithATimeoutOf300Seconds_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_29(); + break; + case 30: + ChipLogProgress(chipTool, + " ***** Test Step 30 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event Clear\n"); + if (ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectCoAlarmTestEventClear_30(); + break; + case 31: + ChipLogProgress(chipTool, + " ***** Test Step 31 : TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 " + "seconds\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfInterconnectCOAlarmAttributeFromDutWithATimeoutOf300Seconds_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_32(); + break; + case 33: + ChipLogProgress(chipTool, + " ***** Test Step 33 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event Clear\n"); + if (ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectSmokeAlarmTestEventClear_33(); + break; + case 34: + ChipLogProgress(chipTool, + " ***** Test Step 34 : TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 " + "seconds\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfInterconnectSmokeAlarmAttributeFromDutWithATimeoutOf300Seconds_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_35(); + break; + case 36: + ChipLogProgress(chipTool, + " ***** Test Step 36 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Battery Alert Test Event Clear\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForBatteryAlertTestEventClear_36(); + break; + case 37: + ChipLogProgress(chipTool, + " ***** Test Step 37 : TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0003")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfBatteryAlertAttributeFromDutWithATimeoutOf300Seconds_37(); + break; + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_38(); + 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), 0)); + 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), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 38: + 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(3090)); } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 39; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + chip::Optional mTestEventTriggerKey; + chip::Optional mTestEventTriggerWarningSmokeAlarm; + chip::Optional mTestEventTriggerSmokeAlarmClear; + chip::Optional mTestEventTriggerWarningCoAlarm; + chip::Optional mTestEventTriggerCoAlarmClear; + chip::Optional mTestEventTriggerWarningBatteryAlert; + chip::Optional mTestEventTriggerBatteryAlertClear; + chip::Optional mTestEventTriggerInterconnectSmokeAlarm; + chip::Optional mTestEventTriggerInterconnectSmokeAlarmClear; + chip::Optional mTestEventTriggerInterconnectCoAlarm; + chip::Optional mTestEventTriggerInterconnectCoAlarmClear; + chip::Optional mHiestPriAlarm; + chip::Optional mHiestPriAlarm2; + chip::Optional mHiestPriAlarm3; + chip::Optional mHiestPriAlarm4; + chip::Optional mHiestPriAlarm5; + + CHIP_ERROR TestCommissionDutToTh_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ExpressedState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_2_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToBatteryAlertAttributeFromDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to BatteryAlert attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("BatteryAlert", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("batteryAlert", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_2_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToBatteryAlertAttributeFromDut_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = true; + [cluster subscribeAttributeBatteryAlertWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn( + testSendClusterTest_TC_SMOKECO_2_6_2_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to BatteryAlert attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported; + test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_4_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToInterconnectSmokeAlarmAttributeFromDut_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to InterconnectSmokeAlarm attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("InterconnectSmokeAlarm", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("interconnectSmokeAlarm", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_4_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToInterconnectSmokeAlarmAttributeFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = false; + [cluster subscribeAttributeInterconnectSmokeAlarmWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn( + testSendClusterTest_TC_SMOKECO_2_6_4_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to InterconnectSmokeAlarm attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported; + test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_6_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToInterconnectCOAlarmAttributeFromDut_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to InterconnectCOAlarm attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("InterconnectCOAlarm", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("interconnectCOAlarm", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_6_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToInterconnectCOAlarmAttributeFromDut_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = false; + [cluster subscribeAttributeInterconnectCOAlarmWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn( + testSendClusterTest_TC_SMOKECO_2_6_6_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to InterconnectCOAlarm attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported; + test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_8_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_COState_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToCOStateAttributeFromDut_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_COState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to COState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("COState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("COState", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_8_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToCOStateAttributeFromDut_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = false; + [cluster subscribeAttributeCOStateWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn( + testSendClusterTest_TC_SMOKECO_2_6_8_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to COState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_COState_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_COState_Reported; + test_Test_TC_SMOKECO_2_6_COState_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_10_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_SmokeState_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToSmokeStateAttributeFromDut_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_SmokeState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to SmokeState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("SmokeState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("smokeState", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_10_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToSmokeStateAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = false; + [cluster subscribeAttributeSmokeStateWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn(testSendClusterTest_TC_SMOKECO_2_6_10_WaitForReport_Fulfilled, + SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to SmokeState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_SmokeState_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_SmokeState_Reported; + test_Test_TC_SMOKECO_2_6_SmokeState_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsTestEventTriggersEnabledAttributeFromGeneralDiagnosticsCluster_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeTestEventTriggersEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("TestEventTriggersEnabled", actualValue, 1)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningBatteryAlertTestEvent_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerWarningBatteryAlert.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerWarningBatteryAlert.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000095ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning Battery Alert Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfBatteryAlertAttributeFromDutWithATimeoutOf300Seconds_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("BatteryAlert", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("batteryAlert", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectSmokeAlarmTestEvent_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerInterconnectSmokeAlarm.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerInterconnectSmokeAlarm.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000092ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfInterconnectSmokeAlarmAttributeFromDutWithATimeoutOf300Seconds_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog( + @"TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("interconnectSmokeAlarm", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("interconnectSmokeAlarm", [value unsignedCharValue], 1U)); + VerifyOrReturn(CheckConstraintMaxValue("interconnectSmokeAlarm", [value unsignedCharValue], 2U)); + + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectCoAlarmTestEvent_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerInterconnectCoAlarm.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerInterconnectCoAlarm.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000094ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfInterconnectCOAlarmAttributeFromDutWithATimeoutOf300Seconds_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("interconnectCOAlarm", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("interconnectCOAlarm", [value unsignedCharValue], 1U)); + VerifyOrReturn(CheckConstraintMaxValue("interconnectCOAlarm", [value unsignedCharValue], 2U)); + + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningCoAlarmTestEvent_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerWarningCoAlarm.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerWarningCoAlarm.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000091ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning CO Alarm Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfCOStateAttributeFromDutWithATimeoutOf300Seconds_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_COState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of COState attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("COState", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("COState", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningSmokeAlarmTestEvent_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerWarningSmokeAlarm.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerWarningSmokeAlarm.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000090ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning Smoke Alarm Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfSmokeStateAttributeFromDutWithATimeoutOf300Seconds_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_SmokeState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("SmokeState", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("smokeState", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ExpressedState", actualValue, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForSmokeAlarmTestEventClear_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerSmokeAlarmClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerSmokeAlarmClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a0ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke Alarm Test Event Clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfSmokeStateAttributeFromDutWithATimeoutOf300Seconds_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_SmokeState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("SmokeState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("smokeState", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn( + CheckValue("ExpressedState", actualValue, mHiestPriAlarm2.HasValue() ? mHiestPriAlarm2.Value() : 2U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForCoAlarmTestEventClear_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerCoAlarmClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerCoAlarmClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a1ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for CO Alarm Test Event clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfCOStateAttributeFromDutWithATimeoutOf300Seconds_28() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_COState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of COState attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("COState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("COState", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_29() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn( + CheckValue("ExpressedState", actualValue, mHiestPriAlarm3.HasValue() ? mHiestPriAlarm3.Value() : 7U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectCoAlarmTestEventClear_30() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerInterconnectCoAlarmClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerInterconnectCoAlarmClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a4ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event Clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfInterconnectCOAlarmAttributeFromDutWithATimeoutOf300Seconds_31() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("InterconnectCOAlarm", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("interconnectCOAlarm", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_32() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn( + CheckValue("ExpressedState", actualValue, mHiestPriAlarm4.HasValue() ? mHiestPriAlarm4.Value() : 7U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectSmokeAlarmTestEventClear_33() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerInterconnectSmokeAlarmClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerInterconnectSmokeAlarmClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a2ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event Clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfInterconnectSmokeAlarmAttributeFromDutWithATimeoutOf300Seconds_34() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog( + @"TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("InterconnectSmokeAlarm", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("interconnectSmokeAlarm", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_35() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn( + CheckValue("ExpressedState", actualValue, mHiestPriAlarm5.HasValue() ? mHiestPriAlarm5.Value() : 3U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForBatteryAlertTestEventClear_36() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerBatteryAlertClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerBatteryAlertClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a5ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Battery Alert Test Event Clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfBatteryAlertAttributeFromDutWithATimeoutOf300Seconds_37() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("BatteryAlert", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("batteryAlert", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_38() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ExpressedState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_SWTCH_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -174668,6 +177515,9 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),