From 314938989d2aa701ee51d24d4d6b96d3c6e79d83 Mon Sep 17 00:00:00 2001 From: Matt Hazley Date: Fri, 16 Jun 2023 14:08:10 +0100 Subject: [PATCH] Adding Test Scripts for Concentration Measurement Clusters (#27215) * Added carbon monoxide measurement test yaml * Added additional concentration measurement test scripts * Updating conc meas clusters in all clusters to support all PICS * Restyled by whitespace * Restyled by prettier-yaml * Fixed formatting on comments * Adding ci pics * Restyled by prettier-yaml * Updates to darwin TestCommandBridge to not always assume the constraint is an integer c/o bzbarsky-apple * Fixed error in TC_CMO_CONC_1_1 with extra && * Adding excludes tests for when the PICS are not switched on and regen tests * Fixed embarrassing typo in hasMasksSet * Restyled by whitespace * Restyled by prettier-yaml * Remove dot in the cluster name for the python chip yaml runner --------- Co-authored-by: Restyled.io --- .../all-clusters-app.matter | 84 +- .../all-clusters-common/all-clusters-app.zap | 152 +- .../commands/tests/TestCommandBridge.h | 20 +- src/app/tests/suites/certification/PICS.yaml | 1056 ++ .../certification/Test_TC_CDOCONC_1_1.yaml | 326 + .../certification/Test_TC_CDOCONC_2_1.yaml | 132 + .../certification/Test_TC_CMOCONC_1_1.yaml | 326 + .../certification/Test_TC_CMOCONC_2_1.yaml | 132 + .../certification/Test_TC_FLDCONC_1_1.yaml | 326 + .../certification/Test_TC_FLDCONC_2_1.yaml | 132 + .../certification/Test_TC_NDOCONC_1_1.yaml | 326 + .../certification/Test_TC_NDOCONC_2_1.yaml | 132 + .../certification/Test_TC_OZCONC_1_1.yaml | 323 + .../certification/Test_TC_OZCONC_2_1.yaml | 132 + .../certification/Test_TC_PMHCONC_1_1.yaml | 326 + .../certification/Test_TC_PMHCONC_2_1.yaml | 132 + .../certification/Test_TC_PMICONC_1_1.yaml | 326 + .../certification/Test_TC_PMICONC_2_1.yaml | 132 + .../certification/Test_TC_PMKCONC_1_1.yaml | 326 + .../certification/Test_TC_PMKCONC_2_1.yaml | 132 + .../certification/Test_TC_RNCONC_1_1.yaml | 323 + .../certification/Test_TC_RNCONC_2_1.yaml | 132 + .../certification/Test_TC_TVOCCONC_1_1.yaml | 326 + .../certification/Test_TC_TVOCCONC_2_1.yaml | 132 + .../tests/suites/certification/ci-pics-values | 287 + src/app/tests/suites/ciTests.json | 23 + src/controller/python/chip/yaml/runner.py | 2 +- .../chip-tool/zap-generated/test/Commands.h | 7569 ++++++++ .../zap-generated/test/Commands.h | 15125 ++++++++++++++++ 29 files changed, 28803 insertions(+), 89 deletions(-) create mode 100644 src/app/tests/suites/certification/Test_TC_CDOCONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_CDOCONC_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_CMOCONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_CMOCONC_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FLDCONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FLDCONC_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_NDOCONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_NDOCONC_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_OZCONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_OZCONC_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_PMHCONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_PMHCONC_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_PMICONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_PMICONC_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_PMKCONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_PMKCONC_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_RNCONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_RNCONC_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_TVOCCONC_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_TVOCCONC_2_1.yaml diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 02d9c1ddec2298..1fd288a34aabd8 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -4366,9 +4366,14 @@ server cluster NitrogenDioxideConcentrationMeasurement = 1043 { readonly attribute nullable single measuredValue = 0; readonly attribute nullable single minMeasuredValue = 1; readonly attribute nullable single maxMeasuredValue = 2; + readonly attribute nullable single peakMeasuredValue = 3; + readonly attribute elapsed_s peakMeasuredValueWindow = 4; + readonly attribute nullable single averageMeasuredValue = 5; + readonly attribute elapsed_s averageMeasuredValueWindow = 6; readonly attribute single uncertainty = 7; readonly attribute MeasurementUnitEnum measurementUnit = 8; readonly attribute MeasurementMediumEnum measurementMedium = 9; + readonly attribute LevelValueEnum levelValue = 10; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -4413,6 +4418,15 @@ server cluster OzoneConcentrationMeasurement = 1045 { kAverageMeasurement = 0x20; } + readonly attribute nullable single measuredValue = 0; + readonly attribute nullable single minMeasuredValue = 1; + readonly attribute nullable single maxMeasuredValue = 2; + readonly attribute nullable single peakMeasuredValue = 3; + readonly attribute elapsed_s peakMeasuredValueWindow = 4; + readonly attribute nullable single averageMeasuredValue = 5; + readonly attribute elapsed_s averageMeasuredValueWindow = 6; + readonly attribute single uncertainty = 7; + readonly attribute MeasurementUnitEnum measurementUnit = 8; readonly attribute MeasurementMediumEnum measurementMedium = 9; readonly attribute LevelValueEnum levelValue = 10; readonly attribute command_id generatedCommandList[] = 65528; @@ -4514,6 +4528,16 @@ server cluster FormaldehydeConcentrationMeasurement = 1067 { kAverageMeasurement = 0x20; } + readonly attribute nullable single measuredValue = 0; + readonly attribute nullable single minMeasuredValue = 1; + readonly attribute nullable single maxMeasuredValue = 2; + readonly attribute nullable single peakMeasuredValue = 3; + readonly attribute elapsed_s peakMeasuredValueWindow = 4; + readonly attribute nullable single averageMeasuredValue = 5; + readonly attribute elapsed_s averageMeasuredValueWindow = 6; + readonly attribute single uncertainty = 7; + readonly attribute MeasurementUnitEnum measurementUnit = 8; + readonly attribute MeasurementMediumEnum measurementMedium = 9; readonly attribute LevelValueEnum levelValue = 10; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; @@ -4679,6 +4703,7 @@ server cluster TotalVolatileOrganicCompoundsConcentrationMeasurement = 1070 { readonly attribute single uncertainty = 7; readonly attribute MeasurementUnitEnum measurementUnit = 8; readonly attribute MeasurementMediumEnum measurementMedium = 9; + readonly attribute LevelValueEnum levelValue = 10; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -4723,6 +4748,15 @@ server cluster RadonConcentrationMeasurement = 1071 { kAverageMeasurement = 0x20; } + readonly attribute nullable single measuredValue = 0; + readonly attribute nullable single minMeasuredValue = 1; + readonly attribute nullable single maxMeasuredValue = 2; + readonly attribute nullable single peakMeasuredValue = 3; + readonly attribute elapsed_s peakMeasuredValueWindow = 4; + readonly attribute nullable single averageMeasuredValue = 5; + readonly attribute elapsed_s averageMeasuredValueWindow = 6; + readonly attribute single uncertainty = 7; + readonly attribute MeasurementUnitEnum measurementUnit = 8; readonly attribute MeasurementMediumEnum measurementMedium = 9; readonly attribute LevelValueEnum levelValue = 10; readonly attribute command_id generatedCommandList[] = 65528; @@ -6617,25 +6651,39 @@ endpoint 1 { ram attribute measuredValue default = 3; ram attribute minMeasuredValue default = 1; ram attribute maxMeasuredValue default = 150; + ram attribute peakMeasuredValue default = 3; + ram attribute peakMeasuredValueWindow default = 120; + ram attribute averageMeasuredValue default = 3; + ram attribute averageMeasuredValueWindow default = 120; ram attribute uncertainty default = 1; ram attribute measurementUnit default = 1; ram attribute measurementMedium default = 0; + ram attribute levelValue default = 1; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 1; + ram attribute featureMap default = 63; ram attribute clusterRevision default = 1; } server cluster OzoneConcentrationMeasurement { + ram attribute measuredValue default = 10; + ram attribute minMeasuredValue default = 3; + ram attribute maxMeasuredValue default = 300; + ram attribute peakMeasuredValue default = 50; + ram attribute peakMeasuredValueWindow default = 3600; + ram attribute averageMeasuredValue default = 20; + ram attribute averageMeasuredValueWindow default = 3600; + ram attribute uncertainty default = 0; + ram attribute measurementUnit default = 0; ram attribute measurementMedium default = 0; ram attribute levelValue default = 1; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 14; + ram attribute featureMap default = 63; ram attribute clusterRevision default = 1; } @@ -6660,12 +6708,22 @@ endpoint 1 { } server cluster FormaldehydeConcentrationMeasurement { - ram attribute levelValue default = 3; + ram attribute measuredValue default = 10; + ram attribute minMeasuredValue default = 0; + ram attribute maxMeasuredValue default = 200; + ram attribute peakMeasuredValue default = 10; + ram attribute peakMeasuredValueWindow default = 7200; + ram attribute averageMeasuredValue default = 2; + ram attribute averageMeasuredValueWindow default = 7200; + ram attribute uncertainty default = 0; + ram attribute measurementUnit default = 3; + ram attribute measurementMedium default = 0; + ram attribute levelValue default = 2; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 2; + ram attribute featureMap default = 63; ram attribute clusterRevision default = 1; } @@ -6690,7 +6748,7 @@ endpoint 1 { } server cluster Pm10ConcentrationMeasurement { - ram attribute measuredValue; + ram attribute measuredValue default = 7; ram attribute minMeasuredValue default = 2; ram attribute maxMeasuredValue default = 400; ram attribute peakMeasuredValue default = 49; @@ -6720,22 +6778,32 @@ endpoint 1 { ram attribute uncertainty default = 1; ram attribute measurementUnit default = 1; ram attribute measurementMedium default = 0; + ram attribute levelValue default = 1; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 49; + ram attribute featureMap default = 63; ram attribute clusterRevision default = 1; } server cluster RadonConcentrationMeasurement { + ram attribute measuredValue default = 10; + ram attribute minMeasuredValue default = 5; + ram attribute maxMeasuredValue default = 100; + ram attribute peakMeasuredValue default = 36; + ram attribute peakMeasuredValueWindow default = 3600; + ram attribute averageMeasuredValue default = 20; + ram attribute averageMeasuredValueWindow default = 3600; + ram attribute uncertainty default = 0; + ram attribute measurementUnit default = 0; ram attribute measurementMedium default = 0; - ram attribute levelValue default = 4; + ram attribute levelValue default = 3; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; callback attribute attributeList; - ram attribute featureMap default = 14; + ram attribute featureMap default = 63; ram attribute clusterRevision default = 1; } diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index e9d11230130810..bbdf3a2c461b57 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -16,6 +16,12 @@ } ], "package": [ + { + "pathRelativity": "relativeToZap", + "path": "../../../src/app/zap-templates/app-templates.json", + "type": "gen-templates-json", + "version": "chip-v1" + }, { "pathRelativity": "relativeToZap", "path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json", @@ -23,12 +29,6 @@ "category": "matter", "version": 1, "description": "Matter SDK ZCL data with some extensions" - }, - { - "pathRelativity": "relativeToZap", - "path": "../../../src/app/zap-templates/app-templates.json", - "type": "gen-templates-json", - "version": "chip-v1" } ], "endpointTypes": [ @@ -21988,11 +21988,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22004,11 +22004,11 @@ "mfgCode": null, "side": "server", "type": "elapsed_s", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "120", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22020,11 +22020,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22036,11 +22036,11 @@ "mfgCode": null, "side": "server", "type": "elapsed_s", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "120", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22100,11 +22100,11 @@ "mfgCode": null, "side": "server", "type": "LevelValueEnum", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22184,7 +22184,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "63", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22264,11 +22264,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "10", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22280,11 +22280,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22296,11 +22296,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "300", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22312,11 +22312,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "50", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22328,11 +22328,11 @@ "mfgCode": null, "side": "server", "type": "elapsed_s", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "3600", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22344,11 +22344,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "20", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22360,11 +22360,11 @@ "mfgCode": null, "side": "server", "type": "elapsed_s", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "3600", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22376,7 +22376,7 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -22392,7 +22392,7 @@ "mfgCode": null, "side": "server", "type": "MeasurementUnitEnum", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -22508,7 +22508,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "14", + "defaultValue": "63", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22912,11 +22912,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "10", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22928,11 +22928,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22944,11 +22944,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "200", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22960,11 +22960,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "10", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22976,11 +22976,11 @@ "mfgCode": null, "side": "server", "type": "elapsed_s", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "7200", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -22992,11 +22992,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -23008,11 +23008,11 @@ "mfgCode": null, "side": "server", "type": "elapsed_s", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "7200", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -23024,7 +23024,7 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -23040,11 +23040,11 @@ "mfgCode": null, "side": "server", "type": "MeasurementUnitEnum", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -23056,7 +23056,7 @@ "mfgCode": null, "side": "server", "type": "MeasurementMediumEnum", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -23076,7 +23076,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -23156,7 +23156,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "63", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -23564,7 +23564,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "7", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24044,11 +24044,11 @@ "mfgCode": null, "side": "server", "type": "LevelValueEnum", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24128,7 +24128,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "49", + "defaultValue": "63", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24208,11 +24208,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "10", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24224,11 +24224,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "5", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24240,11 +24240,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "100", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24256,11 +24256,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "36", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24272,11 +24272,11 @@ "mfgCode": null, "side": "server", "type": "elapsed_s", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "3600", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24288,11 +24288,11 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "20", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24304,11 +24304,11 @@ "mfgCode": null, "side": "server", "type": "elapsed_s", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "1", + "defaultValue": "3600", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24320,7 +24320,7 @@ "mfgCode": null, "side": "server", "type": "single", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -24336,7 +24336,7 @@ "mfgCode": null, "side": "server", "type": "MeasurementUnitEnum", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -24372,7 +24372,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "4", + "defaultValue": "3", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -24452,7 +24452,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "14", + "defaultValue": "63", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h index b99c5976588b3b..445758958fd169 100644 --- a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h +++ b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h @@ -422,34 +422,46 @@ class TestCommandBridge : public CHIPCommandBridge, // Used when the minValue is a saved variable, since ConstraintsChecker does // not expect Core Foundation types. - template ::value, int> = 0> + template ::value && std::is_signed::value, int> = 0> bool CheckConstraintMinValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) { return ConstraintsChecker::CheckConstraintMinValue(itemName, current, [expected longLongValue]); } - template ::value, int> = 0> + template ::value && !std::is_signed::value, int> = 0> bool CheckConstraintMinValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) { return ConstraintsChecker::CheckConstraintMinValue(itemName, current, [expected unsignedLongLongValue]); } + template ::value, int> = 0> + bool CheckConstraintMinValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) + { + return ConstraintsChecker::CheckConstraintMinValue(itemName, current, [expected doubleValue]); + } + using ConstraintsChecker::CheckConstraintMaxValue; // Used when the maxValue is a saved variable, since ConstraintsChecker does // not expect Core Foundation types. - template ::value, int> = 0> + template ::value && std::is_signed::value, int> = 0> bool CheckConstraintMaxValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) { return ConstraintsChecker::CheckConstraintMaxValue(itemName, current, [expected longLongValue]); } - template ::value, int> = 0> + template ::value && !std::is_signed::value, int> = 0> bool CheckConstraintMaxValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) { return ConstraintsChecker::CheckConstraintMaxValue(itemName, current, [expected unsignedLongLongValue]); } + template ::value, int> = 0> + bool CheckConstraintMaxValue(const char * _Nonnull itemName, T current, const NSNumber * _Nonnull expected) + { + return ConstraintsChecker::CheckConstraintMaxValue(itemName, current, [expected doubleValue]); + } + bool CheckConstraintHasValue(const char * _Nonnull itemName, id _Nullable current, bool shouldHaveValue) { if (shouldHaveValue && (current == nil)) { diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index c361661a9a17cb..67ce7560c7456c 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -8245,3 +8245,1059 @@ PICS: # - label: "Changes air quality significantly" id: AIRQUAL.M.AirQualityChange + + # Carbon Dioxide Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the Carbon Dioxide Concentration + Measurement Cluster as a server?" + id: CDOCONC.S + + - label: + "Does the device implement the Carbon Dioxide Concentration + Measurement Cluster as a client?" + id: CDOCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: CDOCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: CDOCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: CDOCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: CDOCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: CDOCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: CDOCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: CDOCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: CDOCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: CDOCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: CDOCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: CDOCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: CDOCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: CDOCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: CDOCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: CDOCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: CDOCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: CDOCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: CDOCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: CDOCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: CDOCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: CDOCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: CDOCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: CDOCONC.S.Afffd + + # Carbon Monoxide Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the Carbon Monoxide Concentration + Measurement Cluster as a server?" + id: CMOCONC.S + + - label: + "Does the device implement the Carbon Monoxide Concentration + Measurement Cluster as a client?" + id: CMOCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: CMOCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: CMOCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: CMOCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: CMOCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: CMOCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: CMOCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: CMOCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: CMOCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: CMOCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: CMOCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: CMOCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: CMOCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: CMOCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: CMOCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: CMOCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: CMOCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: CMOCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: CMOCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: CMOCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: CMOCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: CMOCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: CMOCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: CMOCONC.S.Afffd + + # Carbon Monoxide Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the Carbon Monoxide Concentration + Measurement Cluster as a server?" + id: CMOCONC.S + + - label: + "Does the device implement the Carbon Monoxide Concentration + Measurement Cluster as a client?" + id: CMOCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: CMOCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: CMOCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: CMOCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: CMOCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: CMOCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: CMOCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: CMOCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: CMOCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: CMOCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: CMOCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: CMOCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: CMOCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: CMOCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: CMOCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: CMOCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: CMOCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: CMOCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: CMOCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: CMOCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: CMOCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: CMOCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: CMOCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: CMOCONC.S.Afffd + + # Nitrogen Dioxide Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the Nitrogen Dioxide Concentration + Measurement Cluster as a server?" + id: NDOCONC.S + + - label: + "Does the device implement the Nitrogen Dioxide Concentration + Measurement Cluster as a client?" + id: NDOCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: NDOCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: NDOCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: NDOCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: NDOCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: NDOCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: NDOCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: NDOCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: NDOCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: NDOCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: NDOCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: NDOCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: NDOCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: NDOCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: NDOCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: NDOCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: NDOCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: NDOCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: NDOCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: NDOCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: NDOCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: NDOCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: NDOCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: NDOCONC.S.Afffd + + # Ozone Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the Ozone Concentration Measurement Cluster + as a server?" + id: OZCONC.S + + - label: + "Does the device implement the Ozone Concentration Measurement Cluster + as a client?" + id: OZCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: OZCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: OZCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: OZCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: OZCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: OZCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: OZCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: OZCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: OZCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: OZCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: OZCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: OZCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: OZCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: OZCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: OZCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: OZCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: OZCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: OZCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: OZCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: OZCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: OZCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: OZCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: OZCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: OZCONC.S.Afffd + + # PM2.5 Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the PM2.5 Concentration Measurement Cluster + as a server?" + id: PMICONC.S + + - label: + "Does the device implement the PM2.5 Concentration Measurement Cluster + as a client?" + id: PMICONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: PMICONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: PMICONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: PMICONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: PMICONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: PMICONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: PMICONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: PMICONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: PMICONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: PMICONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: PMICONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: PMICONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: PMICONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: PMICONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: PMICONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: PMICONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: PMICONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: PMICONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: PMICONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: PMICONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: PMICONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: PMICONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: PMICONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: PMICONC.S.Afffd + + # Formaldehyde Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the Formaldehyde Concentration Measurement + Cluster as a server?" + id: FLDCONC.S + + - label: + "Does the device implement the Formaldehyde Concentration Measurement + Cluster as a client?" + id: FLDCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: FLDCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: FLDCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: FLDCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: FLDCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: FLDCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: FLDCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: FLDCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: FLDCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: FLDCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: FLDCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: FLDCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: FLDCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: FLDCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: FLDCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: FLDCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: FLDCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: FLDCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: FLDCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: FLDCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: FLDCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: FLDCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: FLDCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: FLDCONC.S.Afffd + + # PM1 Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the PM1 Concentration Measurement Cluster + as a server?" + id: PMHCONC.S + + - label: + "Does the device implement the PM1 Concentration Measurement Cluster + as a client?" + id: PMHCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: PMHCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: PMHCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: PMHCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: PMHCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: PMHCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: PMHCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: PMHCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: PMHCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: PMHCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: PMHCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: PMHCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: PMHCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: PMHCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: PMHCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: PMHCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: PMHCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: PMHCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: PMHCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: PMHCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: PMHCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: PMHCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: PMHCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: PMHCONC.S.Afffd + + # PM10 Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the PM10 Concentration Measurement Cluster + as a server?" + id: PMKCONC.S + + - label: + "Does the device implement the PM10 Concentration Measurement Cluster + as a client?" + id: PMKCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: PMKCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: PMKCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: PMKCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: PMKCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: PMKCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: PMKCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: PMKCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: PMKCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: PMKCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: PMKCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: PMKCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: PMKCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: PMKCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: PMKCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: PMKCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: PMKCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: PMKCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: PMKCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: PMKCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: PMKCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: PMKCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: PMKCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: PMKCONC.S.Afffd + + # Total Volatile Organic Compounds Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the Total Volatile Organic Compounds + Concentration Measurement Cluster as a server?" + id: TVOCCONC.S + + - label: + "Does the device implement the Total Volatile Organic Compounds + Concentration Measurement Cluster as a client?" + id: TVOCCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: TVOCCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: TVOCCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: TVOCCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: TVOCCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: TVOCCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: TVOCCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: TVOCCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: TVOCCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: TVOCCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: TVOCCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: TVOCCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: TVOCCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: TVOCCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: TVOCCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: TVOCCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: TVOCCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: TVOCCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: TVOCCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: TVOCCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: TVOCCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: TVOCCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: TVOCCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: TVOCCONC.S.Afffd + + # Radon Concentration Measurement Cluster Test Plan + - label: + "Does the device implement the Radon Concentration Measurement Cluster + as a server?" + id: RNCONC.S + + - label: + "Does the device implement the Radon Concentration Measurement Cluster + as a client?" + id: RNCONC.C + + # + # server / features + # + + - label: "Does the DUT(server) support the Numeric Measurement feature?" + id: RNCONC.S.F00 + + - label: "Does the DUT(server) support the Level Indication feature?" + id: RNCONC.S.F01 + + - label: "Does the DUT(server) support the Medium Level feature?" + id: RNCONC.S.F02 + + - label: "Does the DUT(server) support the Critical Level feature?" + id: RNCONC.S.F03 + + - label: "Does the DUT(server) support the Peak Measurement feature?" + id: RNCONC.S.F04 + + - label: "Does the DUT(server) support the Average Measurement feature?" + id: RNCONC.S.F05 + + # + # server / attributes + # + + - label: "Does the DUT(server) implement the MeasuredValue attribute?" + id: RNCONC.S.A0000 + + - label: "Does the DUT(server) implement the MinMeasuredValue attribute?" + id: RNCONC.S.A0001 + + - label: "Does the DUT(server) implement the MaxMeasuredValue attribute?" + id: RNCONC.S.A0002 + + - label: "Does the DUT(server) implement the PeakMeasuredValue attribute?" + id: RNCONC.S.A0003 + + - label: + "Does the DUT(server) implement the PeakMeasuredValueWindow attribute?" + id: RNCONC.S.A0004 + + - label: + "Does the DUT(server) implement the AverageMeasuredValue attribute?" + id: RNCONC.S.A0005 + + - label: + "Does the DUT(server) implement the AverageMeasuredValueWindow + attribute?" + id: RNCONC.S.A0006 + + - label: "Does the DUT(server) implement the Uncertainty attribute?" + id: RNCONC.S.A0007 + + - label: "Does the DUT(server) implement the MeasurementUnit attribute?" + id: RNCONC.S.A0008 + + - label: "Does the DUT(server) implement the MeasurementMedium attribute?" + id: RNCONC.S.A0009 + + - label: "Does the DUT(server) implement the LevelValue attribute?" + id: RNCONC.S.A000a + + - label: + "Does the device implement the (0xFFF8) GeneratedCommandList + attribute?" + id: RNCONC.S.Afff8 + + - label: + "Does the device implement the (0xFFF9) AcceptedCommandList attribute?" + id: RNCONC.S.Afff9 + + - label: "Does the device implement the (0xFFFA) EventList attribute ?" + id: RNCONC.S.Afffa + + - label: "Does the device implement the (0xFFFB) AttributeList attribute ?" + id: RNCONC.S.Afffb + + - label: "Does the device implement the (0xFFFC) FeatureMap attribute ?" + id: RNCONC.S.Afffc + + - label: + "Does the device implement the (0xFFFD) ClusterRevision attribute ?" + id: RNCONC.S.Afffd diff --git a/src/app/tests/suites/certification/Test_TC_CDOCONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_CDOCONC_1_1.yaml new file mode 100644 index 00000000000000..96322964ee381d --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CDOCONC_1_1.yaml @@ -0,0 +1,326 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-CDOCONC-1.1] Global Attributes with DUT as Server + +PICS: + - CDOCONC.S + +config: + nodeId: 0x12344321 + cluster: "Carbon Dioxide Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: CDOCONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: + "Given CDOCONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && CDOCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given CDOCONC.S.F00(MEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && !CDOCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: + "Given CDOCONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && CDOCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given CDOCONC.S.F01(LEV) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && !CDOCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: + "Given CDOCONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && CDOCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given CDOCONC.S.F02(MED) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && !CDOCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given CDOCONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && CDOCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given CDOCONC.S.F03(CRI) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && !CDOCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given CDOCONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && CDOCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given CDOCONC.S.F04(PEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && !CDOCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given CDOCONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && CDOCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given CDOCONC.S.F05(AVG) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CDOCONC.S.Afffc && !CDOCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && CDOCONC.S.A0007 && CDOCONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when CDOCONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && !CDOCONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && CDOCONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + CDOCONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && !CDOCONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && CDOCONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when CDOCONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && !CDOCONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && CDOCONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when CDOCONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && !CDOCONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && CDOCONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + CDOCONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CDOCONC.S.Afffb && !CDOCONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: CDOCONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: CDOCONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: CDOCONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_CDOCONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_CDOCONC_2_1.yaml new file mode 100644 index 00000000000000..8c4e2c94f0f206 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CDOCONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-CDOCONC-2.1] Attributes with server as DUT + +PICS: + - CDOCONC.S + +config: + nodeId: 0x12344321 + cluster: "Carbon Dioxide Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: CDOCONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: CDOCONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: CDOCONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: CDOCONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: CDOCONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: CDOCONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: CDOCONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: CDOCONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: CDOCONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: CDOCONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/Test_TC_CMOCONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_CMOCONC_1_1.yaml new file mode 100644 index 00000000000000..038e7fea3ae448 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CMOCONC_1_1.yaml @@ -0,0 +1,326 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-CMOCONC-1.1] Global Attributes with DUT as Server + +PICS: + - CMOCONC.S + +config: + nodeId: 0x12344321 + cluster: "Carbon Monoxide Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: CMOCONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: + "Given CMOCONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && CMOCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given CMOCONC.S.F00(MEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && !CMOCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: + "Given CMOCONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && CMOCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given CMOCONC.S.F01(LEV) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && !CMOCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: + "Given CMOCONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && CMOCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given CMOCONC.S.F02(MED) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && !CMOCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given CMOCONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && CMOCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given CMOCONC.S.F03(CRI) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && !CMOCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given CMOCONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && CMOCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given CMOCONC.S.F04(PEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && !CMOCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given CMOCONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && CMOCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given CMOCONC.S.F05(AVG) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CMOCONC.S.Afffc && !CMOCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && CMOCONC.S.A0007 && CMOCONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when CMOCONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && !CMOCONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && CMOCONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + CMOCONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && !CMOCONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && CMOCONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when CMOCONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && !CMOCONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && CMOCONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when CMOCONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && !CMOCONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && CMOCONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + CMOCONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: CMOCONC.S.Afffb && !CMOCONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: CMOCONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: CMOCONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: CMOCONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_CMOCONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_CMOCONC_2_1.yaml new file mode 100644 index 00000000000000..84c4410dbee398 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CMOCONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-CMOCONC-2.1] Attributes with server as DUT + +PICS: + - CMOCONC.S + +config: + nodeId: 0x12344321 + cluster: "Carbon Monoxide Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: CMOCONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: CMOCONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: CMOCONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: CMOCONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: CMOCONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: CMOCONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: CMOCONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: CMOCONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: CMOCONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: CMOCONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/Test_TC_FLDCONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_FLDCONC_1_1.yaml new file mode 100644 index 00000000000000..7edd006fcc2b14 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FLDCONC_1_1.yaml @@ -0,0 +1,326 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-FLDCONC-1.1] Global Attributes with DUT as Server + +PICS: + - FLDCONC.S + +config: + nodeId: 0x12344321 + cluster: "Formaldehyde Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: FLDCONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: + "Given FLDCONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && FLDCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given FLDCONC.S.F00(MEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && !FLDCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: + "Given FLDCONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && FLDCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given FLDCONC.S.F01(LEV) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && !FLDCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: + "Given FLDCONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && FLDCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given FLDCONC.S.F02(MED) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && !FLDCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given FLDCONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && FLDCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given FLDCONC.S.F03(CRI) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && !FLDCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given FLDCONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && FLDCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given FLDCONC.S.F04(PEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && !FLDCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given FLDCONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && FLDCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given FLDCONC.S.F05(AVG) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FLDCONC.S.Afffc && !FLDCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && FLDCONC.S.A0007 && FLDCONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when FLDCONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && !FLDCONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && FLDCONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + FLDCONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && !FLDCONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && FLDCONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when FLDCONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && !FLDCONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && FLDCONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when FLDCONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && !FLDCONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && FLDCONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + FLDCONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: FLDCONC.S.Afffb && !FLDCONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: FLDCONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: FLDCONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: FLDCONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_FLDCONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_FLDCONC_2_1.yaml new file mode 100644 index 00000000000000..88e113b1845488 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FLDCONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-FLDCONC-2.1] Attributes with server as DUT + +PICS: + - FLDCONC.S + +config: + nodeId: 0x12344321 + cluster: "Formaldehyde Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: FLDCONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: FLDCONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: FLDCONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: FLDCONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: FLDCONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: FLDCONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: FLDCONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: FLDCONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: FLDCONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: FLDCONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/Test_TC_NDOCONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_NDOCONC_1_1.yaml new file mode 100644 index 00000000000000..141e04ca8ab9bf --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_NDOCONC_1_1.yaml @@ -0,0 +1,326 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-NDOCONC-1.1] Global Attributes with DUT as Server + +PICS: + - NDOCONC.S + +config: + nodeId: 0x12344321 + cluster: "Nitrogen Dioxide Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: NDOCONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: + "Given NDOCONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && NDOCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given NDOCONC.S.F00(MEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && !NDOCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: + "Given NDOCONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && NDOCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given NDOCONC.S.F01(LEV) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && !NDOCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: + "Given NDOCONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && NDOCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given NDOCONC.S.F02(MED) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && !NDOCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given NDOCONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && NDOCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given NDOCONC.S.F03(CRI) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && !NDOCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given NDOCONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && NDOCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given NDOCONC.S.F04(PEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && !NDOCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given NDOCONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && NDOCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given NDOCONC.S.F05(AVG) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: NDOCONC.S.Afffc && !NDOCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && NDOCONC.S.A0007 && NDOCONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when NDOCONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && !NDOCONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && NDOCONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + NDOCONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && !NDOCONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && NDOCONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when NDOCONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && !NDOCONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && NDOCONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when NDOCONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && !NDOCONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && NDOCONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + NDOCONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: NDOCONC.S.Afffb && !NDOCONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: NDOCONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: NDOCONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: NDOCONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_NDOCONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_NDOCONC_2_1.yaml new file mode 100644 index 00000000000000..2b4efbf5b459aa --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_NDOCONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-NDOCONC-2.1] Attributes with server as DUT + +PICS: + - NDOCONC.S + +config: + nodeId: 0x12344321 + cluster: "Nitrogen Dioxide Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: NDOCONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: NDOCONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: NDOCONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: NDOCONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: NDOCONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: NDOCONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: NDOCONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: NDOCONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: NDOCONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: NDOCONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/Test_TC_OZCONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_OZCONC_1_1.yaml new file mode 100644 index 00000000000000..48699e1875248c --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_OZCONC_1_1.yaml @@ -0,0 +1,323 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-OZCONC-1.1] Global Attributes with DUT as Server + +PICS: + - OZCONC.S + +config: + nodeId: 0x12344321 + cluster: "Ozone Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: OZCONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: "Given OZCONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && OZCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given OZCONC.S.F00(MEA) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && !OZCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: "Given OZCONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && OZCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given OZCONC.S.F01(LEV) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && !OZCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: "Given OZCONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && OZCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given OZCONC.S.F02(MED) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && !OZCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given OZCONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && OZCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given OZCONC.S.F03(CRI) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && !OZCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given OZCONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && OZCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given OZCONC.S.F04(PEA) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && !OZCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given OZCONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && OZCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given OZCONC.S.F05(AVG) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZCONC.S.Afffc && !OZCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && OZCONC.S.A0007 && OZCONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when OZCONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && !OZCONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && OZCONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + OZCONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && !OZCONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && OZCONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when OZCONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && !OZCONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && OZCONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when OZCONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && !OZCONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && OZCONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + OZCONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: OZCONC.S.Afffb && !OZCONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: OZCONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: OZCONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: OZCONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_OZCONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_OZCONC_2_1.yaml new file mode 100644 index 00000000000000..a022b6a9475012 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_OZCONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-OZCONC-2.1] Attributes with server as DUT + +PICS: + - OZCONC.S + +config: + nodeId: 0x12344321 + cluster: "Ozone Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: OZCONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: OZCONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: OZCONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: OZCONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: OZCONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: OZCONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: OZCONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: OZCONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: OZCONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: OZCONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/Test_TC_PMHCONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PMHCONC_1_1.yaml new file mode 100644 index 00000000000000..866f5c2b6fd6ab --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_PMHCONC_1_1.yaml @@ -0,0 +1,326 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-PMHCONC-1.1] Global Attributes with DUT as Server + +PICS: + - PMHCONC.S + +config: + nodeId: 0x12344321 + cluster: "PM1 Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: PMHCONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: + "Given PMHCONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && PMHCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given PMHCONC.S.F00(MEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && !PMHCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: + "Given PMHCONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && PMHCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given PMHCONC.S.F01(LEV) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && !PMHCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: + "Given PMHCONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && PMHCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given PMHCONC.S.F02(MED) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && !PMHCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given PMHCONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && PMHCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given PMHCONC.S.F03(CRI) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && !PMHCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given PMHCONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && PMHCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given PMHCONC.S.F04(PEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && !PMHCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given PMHCONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && PMHCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given PMHCONC.S.F05(AVG) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMHCONC.S.Afffc && !PMHCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && PMHCONC.S.A0007 && PMHCONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when PMHCONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && !PMHCONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && PMHCONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + PMHCONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && !PMHCONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && PMHCONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when PMHCONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && !PMHCONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && PMHCONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when PMHCONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && !PMHCONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && PMHCONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + PMHCONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMHCONC.S.Afffb && !PMHCONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: PMHCONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: PMHCONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: PMHCONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_PMHCONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_PMHCONC_2_1.yaml new file mode 100644 index 00000000000000..5a86bf09654f7a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_PMHCONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-PMHCONC-2.1] Attributes with server as DUT + +PICS: + - PMHCONC.S + +config: + nodeId: 0x12344321 + cluster: "PM1 Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: PMHCONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: PMHCONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: PMHCONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: PMHCONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: PMHCONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: PMHCONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: PMHCONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: PMHCONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: PMHCONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: PMHCONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/Test_TC_PMICONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PMICONC_1_1.yaml new file mode 100644 index 00000000000000..1d9e1c5168ea1e --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_PMICONC_1_1.yaml @@ -0,0 +1,326 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-PMICONC-1.1] Global Attributes with DUT as Server + +PICS: + - PMICONC.S + +config: + nodeId: 0x12344321 + cluster: "PM2.5 Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: PMICONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: + "Given PMICONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && PMICONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given PMICONC.S.F00(MEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && !PMICONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: + "Given PMICONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && PMICONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given PMICONC.S.F01(LEV) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && !PMICONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: + "Given PMICONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && PMICONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given PMICONC.S.F02(MED) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && !PMICONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given PMICONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && PMICONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given PMICONC.S.F03(CRI) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && !PMICONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given PMICONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && PMICONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given PMICONC.S.F04(PEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && !PMICONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given PMICONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && PMICONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given PMICONC.S.F05(AVG) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMICONC.S.Afffc && !PMICONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && PMICONC.S.A0007 && PMICONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when PMICONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && !PMICONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && PMICONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + PMICONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && !PMICONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && PMICONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when PMICONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && !PMICONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && PMICONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when PMICONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && !PMICONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && PMICONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + PMICONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMICONC.S.Afffb && !PMICONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: PMICONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: PMICONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: PMICONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_PMICONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_PMICONC_2_1.yaml new file mode 100644 index 00000000000000..34e5856a092bc2 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_PMICONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-PMICONC-2.1] Attributes with server as DUT + +PICS: + - PMICONC.S + +config: + nodeId: 0x12344321 + cluster: "PM2.5 Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: PMICONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: PMICONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: PMICONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: PMICONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: PMICONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: PMICONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: PMICONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: PMICONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: PMICONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: PMICONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/Test_TC_PMKCONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PMKCONC_1_1.yaml new file mode 100644 index 00000000000000..b0443d6aa1f38b --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_PMKCONC_1_1.yaml @@ -0,0 +1,326 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-PMKCONC-1.1] Global Attributes with DUT as Server + +PICS: + - PMKCONC.S + +config: + nodeId: 0x12344321 + cluster: "PM10 Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: PMKCONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: + "Given PMKCONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && PMKCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given PMKCONC.S.F00(MEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && !PMKCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: + "Given PMKCONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && PMKCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given PMKCONC.S.F01(LEV) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && !PMKCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: + "Given PMKCONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && PMKCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given PMKCONC.S.F02(MED) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && !PMKCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given PMKCONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && PMKCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given PMKCONC.S.F03(CRI) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && !PMKCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given PMKCONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && PMKCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given PMKCONC.S.F04(PEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && !PMKCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given PMKCONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && PMKCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given PMKCONC.S.F05(AVG) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: PMKCONC.S.Afffc && !PMKCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && PMKCONC.S.A0007 && PMKCONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when PMKCONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && !PMKCONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && PMKCONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + PMKCONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && !PMKCONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && PMKCONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when PMKCONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && !PMKCONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && PMKCONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when PMKCONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && !PMKCONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && PMKCONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + PMKCONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: PMKCONC.S.Afffb && !PMKCONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: PMKCONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: PMKCONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: PMKCONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_PMKCONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_PMKCONC_2_1.yaml new file mode 100644 index 00000000000000..306df0864ddcfa --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_PMKCONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-PMKCONC-2.1] Attributes with server as DUT + +PICS: + - PMKCONC.S + +config: + nodeId: 0x12344321 + cluster: "PM10 Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: PMKCONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: PMKCONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: PMKCONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: PMKCONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: PMKCONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: PMKCONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: PMKCONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: PMKCONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: PMKCONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: PMKCONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/Test_TC_RNCONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_RNCONC_1_1.yaml new file mode 100644 index 00000000000000..d6813ae51ba754 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_RNCONC_1_1.yaml @@ -0,0 +1,323 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-RNCONC-1.1] Global Attributes with DUT as Server + +PICS: + - RNCONC.S + +config: + nodeId: 0x12344321 + cluster: "Radon Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: RNCONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: "Given RNCONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && RNCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given RNCONC.S.F00(MEA) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && !RNCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: "Given RNCONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && RNCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given RNCONC.S.F01(LEV) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && !RNCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: "Given RNCONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && RNCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given RNCONC.S.F02(MED) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && !RNCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given RNCONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && RNCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given RNCONC.S.F03(CRI) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && !RNCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given RNCONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && RNCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given RNCONC.S.F04(PEA) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && !RNCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given RNCONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && RNCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given RNCONC.S.F05(AVG) is not set, ensure featuremap has the correct + bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: RNCONC.S.Afffc && !RNCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && RNCONC.S.A0007 && RNCONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when RNCONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && !RNCONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && RNCONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + RNCONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && !RNCONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && RNCONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when RNCONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && !RNCONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && RNCONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when RNCONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && !RNCONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && RNCONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + RNCONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: RNCONC.S.Afffb && !RNCONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: RNCONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: RNCONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: RNCONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_RNCONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_RNCONC_2_1.yaml new file mode 100644 index 00000000000000..ec39982a78a0e5 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_RNCONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-RNCONC-2.1] Attributes with server as DUT + +PICS: + - RNCONC.S + +config: + nodeId: 0x12344321 + cluster: "Radon Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: RNCONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: RNCONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: RNCONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: RNCONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: RNCONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: RNCONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: RNCONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: RNCONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: RNCONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: RNCONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/Test_TC_TVOCCONC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TVOCCONC_1_1.yaml new file mode 100644 index 00000000000000..e30bc5768c025e --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_TVOCCONC_1_1.yaml @@ -0,0 +1,326 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.1. [TC-TVOCCONC-1.1] Global Attributes with DUT as Server + +PICS: + - TVOCCONC.S + +config: + nodeId: 0x12344321 + cluster: "Total Volatile Organic Compounds Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + PICS: TVOCCONC.S.Afffd + response: + value: 1 + constraints: + type: int16u + + # TODO: Re-enable when #27248 is fixed + - label: + "Read the global attribute: FeatureMap and check for either bit 0 or 1 + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc + response: + constraints: + type: bitmap32 + hasMasksSet: [0x03] + disabled: true + + - label: + "Given TVOCCONC.S.F00(MEA) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && TVOCCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given TVOCCONC.S.F00(MEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && !TVOCCONC.S.F00 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + - label: + "Given TVOCCONC.S.F01(LEV) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && TVOCCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Given TVOCCONC.S.F01(LEV) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && !TVOCCONC.S.F01 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x2] + + - label: + "Given TVOCCONC.S.F02(MED) ensure featuremap has the correct bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && TVOCCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4, 0x2] + + - label: + "Given TVOCCONC.S.F02(MED) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && !TVOCCONC.S.F02 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x4] + + - label: + "Given TVOCCONC.S.F03(CRI) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && TVOCCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8, 0x2] + + - label: + "Given TVOCCONC.S.F03(CRI) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && !TVOCCONC.S.F03 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x8] + + - label: + "Given TVOCCONC.S.F04(PEA) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && TVOCCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10, 0x1] + + - label: + "Given TVOCCONC.S.F04(PEA) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && !TVOCCONC.S.F04 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x10] + + - label: + "Given TVOCCONC.S.F05(AVG) ensure featuremap has the correct bits set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && TVOCCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x20, 0x1] + + - label: + "Given TVOCCONC.S.F05(AVG) is not set, ensure featuremap has the + correct bit clear" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TVOCCONC.S.Afffc && !TVOCCONC.S.F05 + response: + constraints: + type: bitmap32 + hasMasksClear: [0x20] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb + response: + constraints: + type: list + contains: [9, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Read the optional attribute Uncertainty in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && TVOCCONC.S.A0007 && TVOCCONC.S.F00 + response: + constraints: + type: list + contains: [7] + + - label: + "Check the optional attribute Uncertainty is excluded from + AttributeList when TVOCCONC.S.A0007 is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && !TVOCCONC.S.A0007 + response: + constraints: + type: list + excludes: [7] + + - label: + "Read the optional, feature dependent attributes MeasuredValue, + MinMeasuredValue, MaxMeasuredValue and Measurement Unit in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && TVOCCONC.S.F00 + response: + constraints: + type: list + contains: [0, 1, 2, 8] + + - label: + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, + Measurement Unit and Uncertainty are excluded from AttributeList when + TVOCCONC.S.F00 (MEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && !TVOCCONC.S.F00 + response: + constraints: + type: list + excludes: [0, 1, 2, 7, 8] + + - label: + "Read the optional, feature dependent attributes PeakMeasuredValue & + PeakMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && TVOCCONC.S.F04 + response: + constraints: + type: list + contains: [3, 4] + + - label: + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded + from AttributeList when TVOCCONC.S.F04 (PEA) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && !TVOCCONC.S.F04 + response: + constraints: + type: list + excludes: [3, 4] + + - label: + "Read the optional, feature dependent attributes AverageMeasuredValue + AverageMeasuredValueWindow in AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && TVOCCONC.S.F05 + response: + constraints: + type: list + contains: [5, 6] + + - label: + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are + excluded from AttributeList when TVOCCONC.S.F05 (AVG) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && !TVOCCONC.S.F05 + response: + constraints: + type: list + excludes: [5, 6] + + - label: + "Read the optional, feature dependent attribute LevelValue in + AttributeList" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && TVOCCONC.S.F01 + response: + constraints: + type: list + contains: [10] + + - label: + "Check that LevelValue is excluded from AttributeList when + TVOCCONC.S.F01 (LEV) is not set" + command: "readAttribute" + attribute: "AttributeList" + PICS: TVOCCONC.S.Afffb && !TVOCCONC.S.F01 + response: + constraints: + type: list + excludes: [10] + + - label: "Read the global attribute: EventList" + command: "readAttribute" + attribute: "EventList" + PICS: TVOCCONC.S.Afffa + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + PICS: TVOCCONC.S.Afff9 + response: + value: [] + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + PICS: TVOCCONC.S.Afff8 + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_TVOCCONC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_TVOCCONC_2_1.yaml new file mode 100644 index 00000000000000..d249a0ff8e5fe6 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_TVOCCONC_2_1.yaml @@ -0,0 +1,132 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 145.1.2. [TC-TVOCCONC-2.1] Attributes with server as DUT + +PICS: + - TVOCCONC.S + +config: + nodeId: 0x12344321 + cluster: "Total Volatile Organic Compounds Concentration Measurement" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the MinMeasuredValue attribute." + PICS: TVOCCONC.S.A0001 + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + saveAs: MinMeasuredValue + constraints: + type: single + minValue: 0 + + - label: "TH reads from the DUT the MaxMeasuredValue attribute." + PICS: TVOCCONC.S.A0002 + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + saveAs: MaxMeasuredValue + constraints: + type: single + minValue: MinMeasuredValue + + - label: "TH reads from the DUT the MeasuredValue attribute." + PICS: TVOCCONC.S.A0000 + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValue attribute." + PICS: TVOCCONC.S.A0003 + command: "readAttribute" + attribute: "PeakMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the PeakMeasuredValueWindow attribute." + PICS: TVOCCONC.S.A0004 + command: "readAttribute" + attribute: "PeakMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the AverageMeasuredValue attribute." + PICS: TVOCCONC.S.A0005 + command: "readAttribute" + attribute: "AverageMeasuredValue" + response: + constraints: + type: single + minValue: MinMeasuredValue + maxValue: MaxMeasuredValue + + - label: "TH reads from the DUT the AverageMeasuredValueWindow attribute." + PICS: TVOCCONC.S.A0006 + command: "readAttribute" + attribute: "AverageMeasuredValueWindow" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 259200 + + - label: "TH reads from the DUT the MeasurementUnit attribute." + PICS: TVOCCONC.S.A0008 + command: "readAttribute" + attribute: "MeasurementUnit" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 7 + + - label: "TH reads from the DUT the MeasurementMedium attribute." + PICS: TVOCCONC.S.A0009 + command: "readAttribute" + attribute: "MeasurementMedium" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the LevelValue attribute." + PICS: TVOCCONC.S.A000a + command: "readAttribute" + attribute: "LevelValue" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index c80574b3b2d6fa..bc2daf1bc488b6 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2242,3 +2242,290 @@ AIRQUAL.S.F03=1 AIRQUAL.S.A0000=1 PICS_USER_PROMPT=0 AIRQUAL.M.AirQualityChange=0 + +# Concentration Measurement +CDOCONC.C=0 +CDOCONC.S=1 +CDOCONC.S.F00=1 +CDOCONC.S.F01=1 +CDOCONC.S.F02=1 +CDOCONC.S.F03=1 +CDOCONC.S.F04=1 +CDOCONC.S.F05=1 +CDOCONC.S.A0000=1 +CDOCONC.S.A0001=1 +CDOCONC.S.A0002=1 +CDOCONC.S.A0003=1 +CDOCONC.S.A0004=1 +CDOCONC.S.A0005=1 +CDOCONC.S.A0006=1 +CDOCONC.S.A0007=1 +CDOCONC.S.A0008=1 +CDOCONC.S.A0009=1 +CDOCONC.S.A000a=1 +CDOCONC.S.Afff8=1 +CDOCONC.S.Afff9=1 +CDOCONC.S.Afffa=1 +CDOCONC.S.Afffb=1 +CDOCONC.S.Afffc=1 +CDOCONC.S.Afffd=1 + +CMOCONC.C=0 +CMOCONC.S=1 +CMOCONC.S.F00=1 +CMOCONC.S.F01=1 +CMOCONC.S.F02=1 +CMOCONC.S.F03=1 +CMOCONC.S.F04=1 +CMOCONC.S.F05=1 +CMOCONC.S.A0000=1 +CMOCONC.S.A0001=1 +CMOCONC.S.A0002=1 +CMOCONC.S.A0003=1 +CMOCONC.S.A0004=1 +CMOCONC.S.A0005=1 +CMOCONC.S.A0006=1 +CMOCONC.S.A0007=1 +CMOCONC.S.A0008=1 +CMOCONC.S.A0009=1 +CMOCONC.S.A000a=1 +CMOCONC.S.Afff8=1 +CMOCONC.S.Afff9=1 +CMOCONC.S.Afffa=1 +CMOCONC.S.Afffb=1 +CMOCONC.S.Afffc=1 +CMOCONC.S.Afffd=1 + +CMOCONC.C=0 +CMOCONC.S=1 +CMOCONC.S.F00=1 +CMOCONC.S.F01=1 +CMOCONC.S.F02=1 +CMOCONC.S.F03=1 +CMOCONC.S.F04=1 +CMOCONC.S.F05=1 +CMOCONC.S.A0000=1 +CMOCONC.S.A0001=1 +CMOCONC.S.A0002=1 +CMOCONC.S.A0003=1 +CMOCONC.S.A0004=1 +CMOCONC.S.A0005=1 +CMOCONC.S.A0006=1 +CMOCONC.S.A0007=1 +CMOCONC.S.A0008=1 +CMOCONC.S.A0009=1 +CMOCONC.S.A000a=1 +CMOCONC.S.Afff8=1 +CMOCONC.S.Afff9=1 +CMOCONC.S.Afffa=1 +CMOCONC.S.Afffb=1 +CMOCONC.S.Afffc=1 +CMOCONC.S.Afffd=1 + +NDOCONC.C=0 +NDOCONC.S=1 +NDOCONC.S.F00=1 +NDOCONC.S.F01=1 +NDOCONC.S.F02=1 +NDOCONC.S.F03=1 +NDOCONC.S.F04=1 +NDOCONC.S.F05=1 +NDOCONC.S.A0000=1 +NDOCONC.S.A0001=1 +NDOCONC.S.A0002=1 +NDOCONC.S.A0003=1 +NDOCONC.S.A0004=1 +NDOCONC.S.A0005=1 +NDOCONC.S.A0006=1 +NDOCONC.S.A0007=1 +NDOCONC.S.A0008=1 +NDOCONC.S.A0009=1 +NDOCONC.S.A000a=1 +NDOCONC.S.Afff8=1 +NDOCONC.S.Afff9=1 +NDOCONC.S.Afffa=1 +NDOCONC.S.Afffb=1 +NDOCONC.S.Afffc=1 +NDOCONC.S.Afffd=1 + +OZCONC.C=0 +OZCONC.S=1 +OZCONC.S.F00=1 +OZCONC.S.F01=1 +OZCONC.S.F02=1 +OZCONC.S.F03=1 +OZCONC.S.F04=1 +OZCONC.S.F05=1 +OZCONC.S.A0000=1 +OZCONC.S.A0001=1 +OZCONC.S.A0002=1 +OZCONC.S.A0003=1 +OZCONC.S.A0004=1 +OZCONC.S.A0005=1 +OZCONC.S.A0006=1 +OZCONC.S.A0007=1 +OZCONC.S.A0008=1 +OZCONC.S.A0009=1 +OZCONC.S.A000a=1 +OZCONC.S.Afff8=1 +OZCONC.S.Afff9=1 +OZCONC.S.Afffa=1 +OZCONC.S.Afffb=1 +OZCONC.S.Afffc=1 +OZCONC.S.Afffd=1 + +PMICONC.C=0 +PMICONC.S=1 +PMICONC.S.F00=1 +PMICONC.S.F01=1 +PMICONC.S.F02=1 +PMICONC.S.F03=1 +PMICONC.S.F04=1 +PMICONC.S.F05=1 +PMICONC.S.A0000=1 +PMICONC.S.A0001=1 +PMICONC.S.A0002=1 +PMICONC.S.A0003=1 +PMICONC.S.A0004=1 +PMICONC.S.A0005=1 +PMICONC.S.A0006=1 +PMICONC.S.A0007=1 +PMICONC.S.A0008=1 +PMICONC.S.A0009=1 +PMICONC.S.A000a=1 +PMICONC.S.Afff8=1 +PMICONC.S.Afff9=1 +PMICONC.S.Afffa=1 +PMICONC.S.Afffb=1 +PMICONC.S.Afffc=1 +PMICONC.S.Afffd=1 + +FLDCONC.C=0 +FLDCONC.S=1 +FLDCONC.S.F00=1 +FLDCONC.S.F01=1 +FLDCONC.S.F02=1 +FLDCONC.S.F03=1 +FLDCONC.S.F04=1 +FLDCONC.S.F05=1 +FLDCONC.S.A0000=1 +FLDCONC.S.A0001=1 +FLDCONC.S.A0002=1 +FLDCONC.S.A0003=1 +FLDCONC.S.A0004=1 +FLDCONC.S.A0005=1 +FLDCONC.S.A0006=1 +FLDCONC.S.A0007=1 +FLDCONC.S.A0008=1 +FLDCONC.S.A0009=1 +FLDCONC.S.A000a=1 +FLDCONC.S.Afff8=1 +FLDCONC.S.Afff9=1 +FLDCONC.S.Afffa=1 +FLDCONC.S.Afffb=1 +FLDCONC.S.Afffc=1 +FLDCONC.S.Afffd=1 + +PMHCONC.C=0 +PMHCONC.S=1 +PMHCONC.S.F00=1 +PMHCONC.S.F01=1 +PMHCONC.S.F02=1 +PMHCONC.S.F03=1 +PMHCONC.S.F04=1 +PMHCONC.S.F05=1 +PMHCONC.S.A0000=1 +PMHCONC.S.A0001=1 +PMHCONC.S.A0002=1 +PMHCONC.S.A0003=1 +PMHCONC.S.A0004=1 +PMHCONC.S.A0005=1 +PMHCONC.S.A0006=1 +PMHCONC.S.A0007=1 +PMHCONC.S.A0008=1 +PMHCONC.S.A0009=1 +PMHCONC.S.A000a=1 +PMHCONC.S.Afff8=1 +PMHCONC.S.Afff9=1 +PMHCONC.S.Afffa=1 +PMHCONC.S.Afffb=1 +PMHCONC.S.Afffc=1 +PMHCONC.S.Afffd=1 + +PMKCONC.C=0 +PMKCONC.S=1 +PMKCONC.S.F00=1 +PMKCONC.S.F01=1 +PMKCONC.S.F02=1 +PMKCONC.S.F03=1 +PMKCONC.S.F04=1 +PMKCONC.S.F05=1 +PMKCONC.S.A0000=1 +PMKCONC.S.A0001=1 +PMKCONC.S.A0002=1 +PMKCONC.S.A0003=1 +PMKCONC.S.A0004=1 +PMKCONC.S.A0005=1 +PMKCONC.S.A0006=1 +PMKCONC.S.A0007=1 +PMKCONC.S.A0008=1 +PMKCONC.S.A0009=1 +PMKCONC.S.A000a=1 +PMKCONC.S.Afff8=1 +PMKCONC.S.Afff9=1 +PMKCONC.S.Afffa=1 +PMKCONC.S.Afffb=1 +PMKCONC.S.Afffc=1 +PMKCONC.S.Afffd=1 + +TVOCCONC.C=0 +TVOCCONC.S=1 +TVOCCONC.S.F00=1 +TVOCCONC.S.F01=1 +TVOCCONC.S.F02=1 +TVOCCONC.S.F03=1 +TVOCCONC.S.F04=1 +TVOCCONC.S.F05=1 +TVOCCONC.S.A0000=1 +TVOCCONC.S.A0001=1 +TVOCCONC.S.A0002=1 +TVOCCONC.S.A0003=1 +TVOCCONC.S.A0004=1 +TVOCCONC.S.A0005=1 +TVOCCONC.S.A0006=1 +TVOCCONC.S.A0007=1 +TVOCCONC.S.A0008=1 +TVOCCONC.S.A0009=1 +TVOCCONC.S.A000a=1 +TVOCCONC.S.Afff8=1 +TVOCCONC.S.Afff9=1 +TVOCCONC.S.Afffa=1 +TVOCCONC.S.Afffb=1 +TVOCCONC.S.Afffc=1 +TVOCCONC.S.Afffd=1 + +RNCONC.C=0 +RNCONC.S=1 +RNCONC.S.F00=1 +RNCONC.S.F01=1 +RNCONC.S.F02=1 +RNCONC.S.F03=1 +RNCONC.S.F04=1 +RNCONC.S.F05=1 +RNCONC.S.A0000=1 +RNCONC.S.A0001=1 +RNCONC.S.A0002=1 +RNCONC.S.A0003=1 +RNCONC.S.A0004=1 +RNCONC.S.A0005=1 +RNCONC.S.A0006=1 +RNCONC.S.A0007=1 +RNCONC.S.A0008=1 +RNCONC.S.A0009=1 +RNCONC.S.A000a=1 +RNCONC.S.Afff8=1 +RNCONC.S.Afff9=1 +RNCONC.S.Afffa=1 +RNCONC.S.Afffb=1 +RNCONC.S.Afffc=1 +RNCONC.S.Afffd=1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 80a913df8b3765..156d22d600efe8 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -301,6 +301,28 @@ "Test_TC_ZEOFREMON_2_1" ], "AirQuality": ["Test_TC_AIRQUAL_1_1", "Test_TC_AIRQUAL_2_1"], + "ConcentrationMeasurement": [ + "Test_TC_CDOCONC_1_1", + "Test_TC_CDOCONC_2_1", + "Test_TC_CMOCONC_1_1", + "Test_TC_CMOCONC_2_1", + "Test_TC_FLDCONC_1_1", + "Test_TC_FLDCONC_2_1", + "Test_TC_NDOCONC_1_1", + "Test_TC_NDOCONC_2_1", + "Test_TC_OZCONC_1_1", + "Test_TC_OZCONC_2_1", + "Test_TC_PMHCONC_1_1", + "Test_TC_PMHCONC_2_1", + "Test_TC_PMICONC_1_1", + "Test_TC_PMICONC_2_1", + "Test_TC_PMKCONC_1_1", + "Test_TC_PMKCONC_2_1", + "Test_TC_RNCONC_1_1", + "Test_TC_RNCONC_2_1", + "Test_TC_TVOCCONC_1_1", + "Test_TC_TVOCCONC_2_1" + ], "collection": [ "AccessControl", "AccessControlEnforcement", @@ -310,6 +332,7 @@ "Actions", "Binding", "ColorControl", + "ConcentrationMeasurement", "DeviceManagement", "Descriptor", "DiagnosticsLogs", diff --git a/src/controller/python/chip/yaml/runner.py b/src/controller/python/chip/yaml/runner.py index bd5dbf99ded8a7..2e21f5eefd7d02 100644 --- a/src/controller/python/chip/yaml/runner.py +++ b/src/controller/python/chip/yaml/runner.py @@ -837,7 +837,7 @@ def _default_pseudo_cluster(self, test_step): def encode(self, request) -> BaseAction: action = None - cluster = request.cluster.replace(' ', '').replace('/', '') + cluster = request.cluster.replace(' ', '').replace('/', '').replace('.', '') command = request.command if cluster == 'CommissionerCommands': return self._commissioner_command_action_factory(request) diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index bd8f0f92d82a80..32ce455574153a 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -75,6 +75,26 @@ class TestList : public Command printf("Test_TC_CC_8_1\n"); printf("TestColorControl_9_1\n"); printf("TestColorControl_9_2\n"); + printf("Test_TC_CDOCONC_1_1\n"); + printf("Test_TC_CDOCONC_2_1\n"); + printf("Test_TC_CMOCONC_1_1\n"); + printf("Test_TC_CMOCONC_2_1\n"); + printf("Test_TC_FLDCONC_1_1\n"); + printf("Test_TC_FLDCONC_2_1\n"); + printf("Test_TC_NDOCONC_1_1\n"); + printf("Test_TC_NDOCONC_2_1\n"); + printf("Test_TC_OZCONC_1_1\n"); + printf("Test_TC_OZCONC_2_1\n"); + printf("Test_TC_PMHCONC_1_1\n"); + printf("Test_TC_PMHCONC_2_1\n"); + printf("Test_TC_PMICONC_1_1\n"); + printf("Test_TC_PMICONC_2_1\n"); + printf("Test_TC_PMKCONC_1_1\n"); + printf("Test_TC_PMKCONC_2_1\n"); + printf("Test_TC_RNCONC_1_1\n"); + printf("Test_TC_RNCONC_2_1\n"); + printf("Test_TC_TVOCCONC_1_1\n"); + printf("Test_TC_TVOCCONC_2_1\n"); printf("TestIcdManagementCluster\n"); printf("Test_TC_OPCREDS_1_2\n"); printf("Test_TC_BINFO_1_1\n"); @@ -23006,6 +23026,7535 @@ class TestColorControl_9_2Suite : public TestCommand } }; +class Test_TC_CDOCONC_1_1Suite : public TestCommand +{ +public: + Test_TC_CDOCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_CDOCONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CDOCONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Given CDOCONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given CDOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given CDOCONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Given CDOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Given CDOCONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Given CDOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Given CDOCONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Given CDOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Given CDOCONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Given CDOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Given CDOCONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Given CDOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.A0007 && CDOCONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when CDOCONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when CDOCONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when CDOCONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "CDOCONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when CDOCONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("CDOCONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CDOCONC_2_1Suite : public TestCommand +{ +public: + Test_TC_CDOCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_CDOCONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CDOCONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::CarbonDioxideConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::CarbonDioxideConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::CarbonDioxideConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, + chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("CDOCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonDioxideConcentrationMeasurement::Id, + CarbonDioxideConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CMOCONC_1_1Suite : public TestCommand +{ +public: + Test_TC_CMOCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_CMOCONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CMOCONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Given CMOCONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given CMOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given CMOCONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Given CMOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Given CMOCONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Given CMOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Given CMOCONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Given CMOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Given CMOCONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Given CMOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Given CMOCONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Given CMOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.A0007 && CMOCONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when CMOCONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when CMOCONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when CMOCONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "CMOCONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when CMOCONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("CMOCONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CMOCONC_2_1Suite : public TestCommand +{ +public: + Test_TC_CMOCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_CMOCONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CMOCONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, + chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("CMOCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CarbonMonoxideConcentrationMeasurement::Id, + CarbonMonoxideConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FLDCONC_1_1Suite : public TestCommand +{ +public: + Test_TC_FLDCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_FLDCONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FLDCONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Given FLDCONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given FLDCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given FLDCONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Given FLDCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Given FLDCONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Given FLDCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Given FLDCONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Given FLDCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Given FLDCONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Given FLDCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Given FLDCONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Given FLDCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.A0007 && FLDCONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when FLDCONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when FLDCONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when FLDCONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "FLDCONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when FLDCONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("FLDCONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FLDCONC_2_1Suite : public TestCommand +{ +public: + Test_TC_FLDCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_FLDCONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FLDCONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::FormaldehydeConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::FormaldehydeConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::FormaldehydeConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("FLDCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FormaldehydeConcentrationMeasurement::Id, + FormaldehydeConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_NDOCONC_1_1Suite : public TestCommand +{ +public: + Test_TC_NDOCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_NDOCONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_NDOCONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "Given NDOCONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given NDOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given NDOCONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Given NDOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Given NDOCONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Given NDOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Given NDOCONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Given NDOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Given NDOCONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Given NDOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Given NDOCONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Given NDOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.A0007 && NDOCONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when NDOCONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when NDOCONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when NDOCONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "NDOCONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when NDOCONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("NDOCONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_NDOCONC_2_1Suite : public TestCommand +{ +public: + Test_TC_NDOCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_NDOCONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_NDOCONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, + chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, + chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("NDOCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), NitrogenDioxideConcentrationMeasurement::Id, + NitrogenDioxideConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OZCONC_1_1Suite : public TestCommand +{ +public: + Test_TC_OZCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OZCONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_OZCONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Given OZCONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given OZCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given OZCONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Given OZCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Given OZCONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Given OZCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Given OZCONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Given OZCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Given OZCONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Given OZCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Given OZCONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Given OZCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && OZCONC.S.A0007 && OZCONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when OZCONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when OZCONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && OZCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when OZCONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && OZCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "OZCONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && OZCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when OZCONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("OZCONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OZCONC_2_1Suite : public TestCommand +{ +public: + Test_TC_OZCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_OZCONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_OZCONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::OzoneConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::OzoneConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::OzoneConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("OZCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneConcentrationMeasurement::Id, + OzoneConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PMHCONC_1_1Suite : public TestCommand +{ +public: + Test_TC_PMHCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_PMHCONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PMHCONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Given PMHCONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given PMHCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given PMHCONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Given PMHCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Given PMHCONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Given PMHCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Given PMHCONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Given PMHCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Given PMHCONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Given PMHCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Given PMHCONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Given PMHCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.A0007 && PMHCONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when PMHCONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when PMHCONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when PMHCONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "PMHCONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when PMHCONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("PMHCONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PMHCONC_2_1Suite : public TestCommand +{ +public: + Test_TC_PMHCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_PMHCONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PMHCONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Pm1ConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Pm1ConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Pm1ConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("PMHCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm1ConcentrationMeasurement::Id, + Pm1ConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PMICONC_1_1Suite : public TestCommand +{ +public: + Test_TC_PMICONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_PMICONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PMICONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Given PMICONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given PMICONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given PMICONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Given PMICONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Given PMICONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Given PMICONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Given PMICONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Given PMICONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Given PMICONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Given PMICONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Given PMICONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Given PMICONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && PMICONC.S.A0007 && PMICONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when PMICONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when PMICONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && PMICONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when PMICONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && PMICONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "PMICONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when PMICONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("PMICONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PMICONC_2_1Suite : public TestCommand +{ +public: + Test_TC_PMICONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_PMICONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PMICONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Pm25ConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Pm25ConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Pm25ConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("PMICONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm25ConcentrationMeasurement::Id, + Pm25ConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PMKCONC_1_1Suite : public TestCommand +{ +public: + Test_TC_PMKCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_PMKCONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PMKCONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Given PMKCONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given PMKCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given PMKCONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Given PMKCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Given PMKCONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Given PMKCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Given PMKCONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Given PMKCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Given PMKCONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Given PMKCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Given PMKCONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Given PMKCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.A0007 && PMKCONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when PMKCONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when PMKCONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when PMKCONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "PMKCONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when PMKCONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("PMKCONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PMKCONC_2_1Suite : public TestCommand +{ +public: + Test_TC_PMKCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_PMKCONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_PMKCONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Pm10ConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Pm10ConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::Pm10ConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("PMKCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Pm10ConcentrationMeasurement::Id, + Pm10ConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_RNCONC_1_1Suite : public TestCommand +{ +public: + Test_TC_RNCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RNCONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_RNCONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Given RNCONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given RNCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given RNCONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Given RNCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Given RNCONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Given RNCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Given RNCONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Given RNCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Given RNCONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "Given RNCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 12: { + LogStep(12, "Given RNCONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Given RNCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && RNCONC.S.A0007 && RNCONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when RNCONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when RNCONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && RNCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when RNCONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && RNCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "RNCONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when RNCONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::EventList::Id, true, chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("RNCONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_RNCONC_2_1Suite : public TestCommand +{ +public: + Test_TC_RNCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_RNCONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_RNCONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::RadonConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::RadonConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::RadonConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::MeasuredValue::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("RNCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), RadonConcentrationMeasurement::Id, + RadonConcentrationMeasurement::Attributes::LevelValue::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TVOCCONC_1_1Suite : public TestCommand +{ +public: + Test_TC_TVOCCONC_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_TVOCCONC_1_1", 28, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TVOCCONC_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 2UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 4UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 4UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 8UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 8UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 16UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 16UL)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 32UL)); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksClear("value", value, 32UL)); + } + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + } + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 8UL)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 8UL)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 4UL)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("value", value, 6UL)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 10UL)); + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("value", value, 10UL)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("acceptedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffd"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::ClusterRevision::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "Given TVOCCONC.S.F00(MEA) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "Given TVOCCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "Given TVOCCONC.S.F01(LEV) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "Given TVOCCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "Given TVOCCONC.S.F02(MED) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "Given TVOCCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F02"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "Given TVOCCONC.S.F03(CRI) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 9: { + LogStep(9, "Given TVOCCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F03"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 10: { + LogStep(10, "Given TVOCCONC.S.F04(PEA) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 11: { + LogStep(11, "Given TVOCCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 12: { + LogStep(12, "Given TVOCCONC.S.F05(AVG) ensure featuremap has the correct bits set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 13: { + LogStep(13, "Given TVOCCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 14: { + LogStep(14, "Read the global attribute: AttributeList"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 15: { + LogStep(15, "Read the optional attribute Uncertainty in AttributeList"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.A0007 && TVOCCONC.S.F00"), + return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 16: { + LogStep(16, "Check the optional attribute Uncertainty is excluded from AttributeList when TVOCCONC.S.A0007 is not set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.A0007"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 17: { + LogStep(17, + "Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + "Measurement Unit in AttributeList"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 18: { + LogStep(18, + "Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + "from AttributeList when TVOCCONC.S.F00 (MEA) is not set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 19: { + LogStep(19, + "Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 20: { + LogStep(20, + "Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when TVOCCONC.S.F04 " + "(PEA) is not set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.F04"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 21: { + LogStep( + 21, + "Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in AttributeList"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 22: { + LogStep(22, + "Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + "TVOCCONC.S.F05 (AVG) is not set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.F05"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 23: { + LogStep(23, "Read the optional, feature dependent attribute LevelValue in AttributeList"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 24: { + LogStep(24, "Check that LevelValue is excluded from AttributeList when TVOCCONC.S.F01 (LEV) is not set"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 25: { + LogStep(25, "Read the global attribute: EventList"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afffa"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::EventList::Id, true, + chip::NullOptional); + } + case 26: { + LogStep(26, "Read the global attribute: AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afff9"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 27: { + LogStep(27, "Read the global attribute: GeneratedCommandList"); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.Afff8"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::GeneratedCommandList::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TVOCCONC_2_1Suite : public TestCommand +{ +public: + Test_TC_TVOCCONC_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_TVOCCONC_2_1", 11, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TVOCCONC_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::app::DataModel::Nullable MinMeasuredValue; + chip::app::DataModel::Nullable MaxMeasuredValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0.0f)); + MinMeasuredValue = value; + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + MaxMeasuredValue = value; + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::Nullable value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("value", value, MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, MaxMeasuredValue)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 259200UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::MeasurementUnitEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 7U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::MeasurementMediumEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::LevelValueEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 4U)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the MinMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MinMeasuredValue::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the MaxMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MaxMeasuredValue::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the MeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasuredValue::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the PeakMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValue::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "TH reads from the DUT the PeakMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0004"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id, + true, chip::NullOptional); + } + case 6: { + LogStep(6, "TH reads from the DUT the AverageMeasuredValue attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValue::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "TH reads from the DUT the AverageMeasuredValueWindow attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0006"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id, + true, chip::NullOptional); + } + case 8: { + LogStep(8, "TH reads from the DUT the MeasurementUnit attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0008"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementUnit::Id, true, + chip::NullOptional); + } + case 9: { + LogStep(9, "TH reads from the DUT the MeasurementMedium attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A0009"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementMedium::Id, true, + chip::NullOptional); + } + case 10: { + LogStep(10, "TH reads from the DUT the LevelValue attribute."); + VerifyOrDo(!ShouldSkip("TVOCCONC.S.A000a"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TotalVolatileOrganicCompoundsConcentrationMeasurement::Id, + TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::LevelValue::Id, true, + chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + class TestIcdManagementClusterSuite : public TestCommand { public: @@ -127130,6 +134679,26 @@ 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), + 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 019717e676f697..8a3451e3fb84cf 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -66,6 +66,26 @@ class TestList : public Command { printf("Test_TC_CC_7_4\n"); printf("TestColorControl_9_1\n"); printf("TestColorControl_9_2\n"); + printf("Test_TC_CDOCONC_1_1\n"); + printf("Test_TC_CDOCONC_2_1\n"); + printf("Test_TC_CMOCONC_1_1\n"); + printf("Test_TC_CMOCONC_2_1\n"); + printf("Test_TC_FLDCONC_1_1\n"); + printf("Test_TC_FLDCONC_2_1\n"); + printf("Test_TC_NDOCONC_1_1\n"); + printf("Test_TC_NDOCONC_2_1\n"); + printf("Test_TC_OZCONC_1_1\n"); + printf("Test_TC_OZCONC_2_1\n"); + printf("Test_TC_PMHCONC_1_1\n"); + printf("Test_TC_PMHCONC_2_1\n"); + printf("Test_TC_PMICONC_1_1\n"); + printf("Test_TC_PMICONC_2_1\n"); + printf("Test_TC_PMKCONC_1_1\n"); + printf("Test_TC_PMKCONC_2_1\n"); + printf("Test_TC_RNCONC_1_1\n"); + printf("Test_TC_RNCONC_2_1\n"); + printf("Test_TC_TVOCCONC_1_1\n"); + printf("Test_TC_TVOCCONC_2_1\n"); printf("Test_TC_OPCREDS_1_2\n"); printf("Test_TC_BINFO_1_1\n"); printf("Test_TC_CNET_1_3\n"); @@ -26826,6 +26846,15091 @@ class TestColorControl_9_2 : public TestCommandBridge { } }; +class Test_TC_CDOCONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_CDOCONC_1_1() + : TestCommandBridge("Test_TC_CDOCONC_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_CDOCONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CDOCONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CDOCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("CDOCONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given CDOCONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Given CDOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given CDOCONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : Given CDOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given CDOCONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Given CDOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given CDOCONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Given CDOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Given CDOCONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given CDOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Given CDOCONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("CDOCONC.S.Afffc && CDOCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given CDOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CDOCONC.S.Afffc && !CDOCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenCdoconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("CDOCONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.A0007 && CDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when " + "CDOCONC.S.A0007 is not set\n"); + if (ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenCdoconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when CDOCONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenCdoconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "CDOCONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenCdoconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when CDOCONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenCdoconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("CDOCONC.S.Afffb && CDOCONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when CDOCONC.S.F01 (LEV) is not set\n"); + if (ShouldSkip("CDOCONC.S.Afffb && !CDOCONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenCdoconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("CDOCONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("CDOCONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("CDOCONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenCdoconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCdoconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CDOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenCdoconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check the optional attribute Uncertainty is excluded from AttributeList when CDOCONC.S.A0007 is not set Error: " + @"%@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenCdoconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when CDOCONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenCdoconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when CDOCONC.S.F04 " + @"(PEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenCdoconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"CDOCONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenCdoconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when CDOCONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_CDOCONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_CDOCONC_2_1() + : TestCommandBridge("Test_TC_CDOCONC_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_CDOCONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CDOCONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CDOCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("CDOCONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("CDOCONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("CDOCONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("CDOCONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("CDOCONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("CDOCONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("CDOCONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("CDOCONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("CDOCONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("CDOCONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CMOCONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_CMOCONC_1_1() + : TestCommandBridge("Test_TC_CMOCONC_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_CMOCONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CMOCONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CMOCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("CMOCONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given CMOCONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Given CMOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given CMOCONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : Given CMOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given CMOCONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Given CMOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given CMOCONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Given CMOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Given CMOCONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given CMOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Given CMOCONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("CMOCONC.S.Afffc && CMOCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given CMOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("CMOCONC.S.Afffc && !CMOCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenCmoconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("CMOCONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.A0007 && CMOCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when " + "CMOCONC.S.A0007 is not set\n"); + if (ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenCmoconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when CMOCONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenCmoconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "CMOCONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenCmoconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when CMOCONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenCmoconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("CMOCONC.S.Afffb && CMOCONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when CMOCONC.S.F01 (LEV) is not set\n"); + if (ShouldSkip("CMOCONC.S.Afffb && !CMOCONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenCmoconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("CMOCONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("CMOCONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("CMOCONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenCmoconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCmoconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CMOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenCmoconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check the optional attribute Uncertainty is excluded from AttributeList when CMOCONC.S.A0007 is not set Error: " + @"%@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenCmoconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when CMOCONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenCmoconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when CMOCONC.S.F04 " + @"(PEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenCmoconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"CMOCONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenCmoconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when CMOCONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_CMOCONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_CMOCONC_2_1() + : TestCommandBridge("Test_TC_CMOCONC_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_CMOCONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CMOCONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CMOCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("CMOCONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("CMOCONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("CMOCONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("CMOCONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("CMOCONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("CMOCONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("CMOCONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("CMOCONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("CMOCONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("CMOCONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FLDCONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FLDCONC_1_1() + : TestCommandBridge("Test_TC_FLDCONC_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_FLDCONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLDCONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLDCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("FLDCONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given FLDCONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenFldconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Given FLDCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenFldconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given FLDCONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenFldconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : Given FLDCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenFldconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given FLDCONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenFldconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Given FLDCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenFldconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given FLDCONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenFldconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Given FLDCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenFldconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Given FLDCONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenFldconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given FLDCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenFldconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Given FLDCONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("FLDCONC.S.Afffc && FLDCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenFldconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given FLDCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("FLDCONC.S.Afffc && !FLDCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenFldconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("FLDCONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.A0007 && FLDCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when " + "FLDCONC.S.A0007 is not set\n"); + if (ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenFldconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when FLDCONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenFldconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "FLDCONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenFldconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when FLDCONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenFldconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("FLDCONC.S.Afffb && FLDCONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when FLDCONC.S.F01 (LEV) is not set\n"); + if (ShouldSkip("FLDCONC.S.Afffb && !FLDCONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenFldconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("FLDCONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("FLDCONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("FLDCONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenFldconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFldconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FLDCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenFldconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check the optional attribute Uncertainty is excluded from AttributeList when FLDCONC.S.A0007 is not set Error: " + @"%@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenFldconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when FLDCONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenFldconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when FLDCONC.S.F04 " + @"(PEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenFldconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"FLDCONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenFldconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when FLDCONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_FLDCONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FLDCONC_2_1() + : TestCommandBridge("Test_TC_FLDCONC_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_FLDCONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLDCONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLDCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("FLDCONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("FLDCONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("FLDCONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("FLDCONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("FLDCONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("FLDCONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("FLDCONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("FLDCONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("FLDCONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("FLDCONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_NDOCONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_NDOCONC_1_1() + : TestCommandBridge("Test_TC_NDOCONC_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_NDOCONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_NDOCONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_NDOCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("NDOCONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given NDOCONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Given NDOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given NDOCONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : Given NDOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given NDOCONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Given NDOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given NDOCONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Given NDOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Given NDOCONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given NDOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Given NDOCONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("NDOCONC.S.Afffc && NDOCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given NDOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("NDOCONC.S.Afffc && !NDOCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenNdoconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("NDOCONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.A0007 && NDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when " + "NDOCONC.S.A0007 is not set\n"); + if (ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenNdoconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when NDOCONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenNdoconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "NDOCONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenNdoconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when NDOCONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenNdoconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("NDOCONC.S.Afffb && NDOCONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when NDOCONC.S.F01 (LEV) is not set\n"); + if (ShouldSkip("NDOCONC.S.Afffb && !NDOCONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenNdoconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("NDOCONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("NDOCONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("NDOCONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenNdoconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenNdoconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given NDOCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenNdoconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check the optional attribute Uncertainty is excluded from AttributeList when NDOCONC.S.A0007 is not set Error: " + @"%@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenNdoconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when NDOCONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenNdoconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when NDOCONC.S.F04 " + @"(PEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenNdoconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"NDOCONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenNdoconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when NDOCONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_NDOCONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_NDOCONC_2_1() + : TestCommandBridge("Test_TC_NDOCONC_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_NDOCONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_NDOCONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_NDOCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("NDOCONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("NDOCONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("NDOCONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("NDOCONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("NDOCONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("NDOCONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("NDOCONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("NDOCONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("NDOCONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("NDOCONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OZCONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_OZCONC_1_1() + : TestCommandBridge("Test_TC_OZCONC_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_OZCONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OZCONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OZCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("OZCONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given OZCONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenOzconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given OZCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenOzconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given OZCONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenOzconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress( + chipTool, " ***** Test Step 5 : Given OZCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenOzconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given OZCONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenOzconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress( + chipTool, " ***** Test Step 7 : Given OZCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenOzconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given OZCONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenOzconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress( + chipTool, " ***** Test Step 9 : Given OZCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenOzconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Given OZCONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenOzconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given OZCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenOzconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Given OZCONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("OZCONC.S.Afffc && OZCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenOzconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given OZCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("OZCONC.S.Afffc && !OZCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenOzconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("OZCONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("OZCONC.S.Afffb && OZCONC.S.A0007 && OZCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when OZCONC.S.A0007 " + "is not set\n"); + if (ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenOzconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("OZCONC.S.Afffb && OZCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when OZCONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenOzconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("OZCONC.S.Afffb && OZCONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "OZCONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenOzconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("OZCONC.S.Afffb && OZCONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when OZCONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenOzconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("OZCONC.S.Afffb && OZCONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when OZCONC.S.F01 (LEV) is not set\n"); + if (ShouldSkip("OZCONC.S.Afffb && !OZCONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenOzconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("OZCONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("OZCONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("OZCONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenOzconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOzconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenOzconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog( + @"Check the optional attribute Uncertainty is excluded from AttributeList when OZCONC.S.A0007 is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenOzconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when OZCONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenOzconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when OZCONC.S.F04 (PEA) " + @"is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenOzconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"OZCONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenOzconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when OZCONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_OZCONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_OZCONC_2_1() + : TestCommandBridge("Test_TC_OZCONC_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_OZCONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OZCONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OZCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("OZCONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("OZCONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("OZCONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("OZCONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("OZCONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("OZCONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("OZCONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("OZCONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("OZCONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("OZCONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PMHCONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_PMHCONC_1_1() + : TestCommandBridge("Test_TC_PMHCONC_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_PMHCONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PMHCONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PMHCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("PMHCONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given PMHCONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Given PMHCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given PMHCONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : Given PMHCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given PMHCONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Given PMHCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given PMHCONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Given PMHCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Given PMHCONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given PMHCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Given PMHCONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("PMHCONC.S.Afffc && PMHCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given PMHCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMHCONC.S.Afffc && !PMHCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenPmhconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("PMHCONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.A0007 && PMHCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when " + "PMHCONC.S.A0007 is not set\n"); + if (ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenPmhconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when PMHCONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenPmhconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "PMHCONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenPmhconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when PMHCONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenPmhconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("PMHCONC.S.Afffb && PMHCONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when PMHCONC.S.F01 (LEV) is not set\n"); + if (ShouldSkip("PMHCONC.S.Afffb && !PMHCONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenPmhconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("PMHCONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("PMHCONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("PMHCONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenPmhconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmhconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMHCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenPmhconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check the optional attribute Uncertainty is excluded from AttributeList when PMHCONC.S.A0007 is not set Error: " + @"%@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenPmhconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when PMHCONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenPmhconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when PMHCONC.S.F04 " + @"(PEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenPmhconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"PMHCONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenPmhconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when PMHCONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_PMHCONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_PMHCONC_2_1() + : TestCommandBridge("Test_TC_PMHCONC_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_PMHCONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PMHCONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PMHCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("PMHCONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("PMHCONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("PMHCONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("PMHCONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("PMHCONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("PMHCONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("PMHCONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("PMHCONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("PMHCONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("PMHCONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PMICONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_PMICONC_1_1() + : TestCommandBridge("Test_TC_PMICONC_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_PMICONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PMICONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PMICONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("PMICONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given PMICONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Given PMICONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given PMICONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : Given PMICONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given PMICONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Given PMICONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given PMICONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Given PMICONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Given PMICONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given PMICONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Given PMICONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("PMICONC.S.Afffc && PMICONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given PMICONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMICONC.S.Afffc && !PMICONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenPmiconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("PMICONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("PMICONC.S.Afffb && PMICONC.S.A0007 && PMICONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when " + "PMICONC.S.A0007 is not set\n"); + if (ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenPmiconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("PMICONC.S.Afffb && PMICONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when PMICONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenPmiconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("PMICONC.S.Afffb && PMICONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "PMICONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenPmiconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("PMICONC.S.Afffb && PMICONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when PMICONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenPmiconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("PMICONC.S.Afffb && PMICONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when PMICONC.S.F01 (LEV) is not set\n"); + if (ShouldSkip("PMICONC.S.Afffb && !PMICONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenPmiconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("PMICONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("PMICONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("PMICONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenPmiconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmiconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMICONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenPmiconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check the optional attribute Uncertainty is excluded from AttributeList when PMICONC.S.A0007 is not set Error: " + @"%@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenPmiconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when PMICONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenPmiconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when PMICONC.S.F04 " + @"(PEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenPmiconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"PMICONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenPmiconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when PMICONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_PMICONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_PMICONC_2_1() + : TestCommandBridge("Test_TC_PMICONC_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_PMICONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PMICONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PMICONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("PMICONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("PMICONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("PMICONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("PMICONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("PMICONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("PMICONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("PMICONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("PMICONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("PMICONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("PMICONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_PMKCONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_PMKCONC_1_1() + : TestCommandBridge("Test_TC_PMKCONC_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_PMKCONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PMKCONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PMKCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("PMKCONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given PMKCONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Given PMKCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given PMKCONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : Given PMKCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given PMKCONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Given PMKCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given PMKCONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Given PMKCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Given PMKCONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given PMKCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Given PMKCONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("PMKCONC.S.Afffc && PMKCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given PMKCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("PMKCONC.S.Afffc && !PMKCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenPmkconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("PMKCONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.A0007 && PMKCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when " + "PMKCONC.S.A0007 is not set\n"); + if (ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenPmkconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when PMKCONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenPmkconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "PMKCONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenPmkconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when PMKCONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenPmkconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("PMKCONC.S.Afffb && PMKCONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when PMKCONC.S.F01 (LEV) is not set\n"); + if (ShouldSkip("PMKCONC.S.Afffb && !PMKCONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenPmkconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("PMKCONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("PMKCONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("PMKCONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenPmkconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenPmkconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given PMKCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenPmkconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check the optional attribute Uncertainty is excluded from AttributeList when PMKCONC.S.A0007 is not set Error: " + @"%@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenPmkconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when PMKCONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenPmkconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when PMKCONC.S.F04 " + @"(PEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenPmkconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"PMKCONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenPmkconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when PMKCONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_PMKCONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_PMKCONC_2_1() + : TestCommandBridge("Test_TC_PMKCONC_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_PMKCONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PMKCONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PMKCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("PMKCONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("PMKCONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("PMKCONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("PMKCONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("PMKCONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("PMKCONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("PMKCONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("PMKCONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("PMKCONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("PMKCONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_RNCONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_RNCONC_1_1() + : TestCommandBridge("Test_TC_RNCONC_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_RNCONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_RNCONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RNCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("RNCONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given RNCONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenRnconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given RNCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenRnconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given RNCONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenRnconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress( + chipTool, " ***** Test Step 5 : Given RNCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenRnconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given RNCONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenRnconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress( + chipTool, " ***** Test Step 7 : Given RNCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenRnconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Given RNCONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenRnconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress( + chipTool, " ***** Test Step 9 : Given RNCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenRnconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Given RNCONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenRnconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given RNCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenRnconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Given RNCONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("RNCONC.S.Afffc && RNCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenRnconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given RNCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("RNCONC.S.Afffc && !RNCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenRnconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("RNCONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("RNCONC.S.Afffb && RNCONC.S.A0007 && RNCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when RNCONC.S.A0007 " + "is not set\n"); + if (ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenRnconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("RNCONC.S.Afffb && RNCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when RNCONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenRnconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("RNCONC.S.Afffb && RNCONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "RNCONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenRnconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("RNCONC.S.Afffb && RNCONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when RNCONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenRnconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("RNCONC.S.Afffb && RNCONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when RNCONC.S.F01 (LEV) is not set\n"); + if (ShouldSkip("RNCONC.S.Afffb && !RNCONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenRnconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("RNCONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("RNCONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("RNCONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenRnconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenRnconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given RNCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenRnconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog( + @"Check the optional attribute Uncertainty is excluded from AttributeList when RNCONC.S.A0007 is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenRnconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when RNCONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenRnconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when RNCONC.S.F04 (PEA) " + @"is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenRnconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"RNCONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenRnconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when RNCONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_RNCONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_RNCONC_2_1() + : TestCommandBridge("Test_TC_RNCONC_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_RNCONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_RNCONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RNCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("RNCONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("RNCONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("RNCONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("RNCONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("RNCONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("RNCONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("RNCONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("RNCONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("RNCONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("RNCONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TVOCCONC_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_TVOCCONC_1_1() + : TestCommandBridge("Test_TC_TVOCCONC_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_TVOCCONC_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TVOCCONC_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TVOCCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + if (ShouldSkip("TVOCCONC.S.Afffd")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Given TVOCCONC.S.F00(MEA) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : Given TVOCCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F00")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Given TVOCCONC.S.F01(LEV) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : Given TVOCCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F01")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Given TVOCCONC.S.F02(MED) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Given TVOCCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F02")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7(); + break; + case 8: + ChipLogProgress( + chipTool, " ***** Test Step 8 : Given TVOCCONC.S.F03(CRI) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Given TVOCCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F03")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : Given TVOCCONC.S.F04(PEA) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10(); + break; + case 11: + ChipLogProgress(chipTool, + " ***** Test Step 11 : Given TVOCCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F04")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : Given TVOCCONC.S.F05(AVG) ensure featuremap has the correct bits set\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && TVOCCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Given TVOCCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear\n"); + if (ShouldSkip("TVOCCONC.S.Afffc && !TVOCCONC.S.F05")) { + NextTest(); + return; + } + err = TestGivenTvocconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read the global attribute: AttributeList\n"); + if (ShouldSkip("TVOCCONC.S.Afffb")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAttributeList_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read the optional attribute Uncertainty in AttributeList\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.A0007 && TVOCCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeUncertaintyInAttributeList_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : Check the optional attribute Uncertainty is excluded from AttributeList when " + "TVOCCONC.S.A0007 is not set\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.A0007")) { + NextTest(); + return; + } + err = TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenTvocconcsa0007IsNotSet_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, " + "MaxMeasuredValue and Measurement Unit in AttributeList\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.F00")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and " + "Uncertainty are excluded from AttributeList when TVOCCONC.S.F00 (MEA) is not set\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.F00")) { + NextTest(); + return; + } + err = TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenTvocconcsf00MeaIsNotSet_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow " + "in AttributeList\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.F04")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when " + "TVOCCONC.S.F04 (PEA) is not set\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.F04")) { + NextTest(); + return; + } + err = TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenTvocconcsf04PeaIsNotSet_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Read the optional, feature dependent attributes AverageMeasuredValue " + "AverageMeasuredValueWindow in AttributeList\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.F05")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from " + "AttributeList when TVOCCONC.S.F05 (AVG) is not set\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.F05")) { + NextTest(); + return; + } + err = TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenTvocconcsf05AvgIsNotSet_22(); + break; + case 23: + ChipLogProgress( + chipTool, " ***** Test Step 23 : Read the optional, feature dependent attribute LevelValue in AttributeList\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && TVOCCONC.S.F01")) { + NextTest(); + return; + } + err = TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : Check that LevelValue is excluded from AttributeList when TVOCCONC.S.F01 (LEV) is not " + "set\n"); + if (ShouldSkip("TVOCCONC.S.Afffb && !TVOCCONC.S.F01")) { + NextTest(); + return; + } + err = TestCheckThatLevelValueIsExcludedFromAttributeListWhenTvocconcsf01LevIsNotSet_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Read the global attribute: EventList\n"); + if (ShouldSkip("TVOCCONC.S.Afffa")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeEventList_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read the global attribute: AcceptedCommandList\n"); + if (ShouldSkip("TVOCCONC.S.Afff9")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeAcceptedCommandList_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Read the global attribute: GeneratedCommandList\n"); + if (ShouldSkip("TVOCCONC.S.Afff8")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeGeneratedCommandList_27(); + 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; + } + + // 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 = 28; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision 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 TestGivenTvocconcsf00meaEnsureFeaturemapHasTheCorrectBitSet_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F00(MEA) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf00meaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F00(MEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf01levEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F01(LEV) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf01levIsNotSetEnsureFeaturemapHasTheCorrectBitClear_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F01(LEV) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf02medEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F02(MED) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf02medIsNotSetEnsureFeaturemapHasTheCorrectBitClear_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F02(MED) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf03criEnsureFeaturemapHasTheCorrectBitsSet_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F03(CRI) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf03criIsNotSetEnsureFeaturemapHasTheCorrectBitClear_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F03(CRI) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf04peaEnsureFeaturemapHasTheCorrectBitsSet_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F04(PEA) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf04peaIsNotSetEnsureFeaturemapHasTheCorrectBitClear_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F04(PEA) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf05avgEnsureFeaturemapHasTheCorrectBitsSet_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F05(AVG) ensure featuremap has the correct bits set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTvocconcsf05avgIsNotSetEnsureFeaturemapHasTheCorrectBitClear_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TVOCCONC.S.F05(AVG) is not set, ensure featuremap has the correct bit clear Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeUncertaintyInAttributeList_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute Uncertainty in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckTheOptionalAttributeUncertaintyIsExcludedFromAttributeListWhenTvocconcsa0007IsNotSet_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check the optional attribute Uncertainty is excluded from AttributeList when TVOCCONC.S.A0007 is not set " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestReadTheOptionalFeatureDependentAttributesMeasuredValueMinMeasuredValueMaxMeasuredValueAndMeasurementUnitInAttributeList_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes MeasuredValue, MinMeasuredValue, MaxMeasuredValue and " + @"Measurement Unit in AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatMeasuredValueMinMeasuredValueMaxMeasuredValueMeasurementUnitAndUncertaintyAreExcludedFromAttributeListWhenTvocconcsf00MeaIsNotSet_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that MeasuredValue, MinMeasuredValue, MaxMeasuredValue, Measurement Unit and Uncertainty are excluded " + @"from AttributeList when TVOCCONC.S.F00 (MEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 1UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesPeakMeasuredValuePeakMeasuredValueWindowInAttributeList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes PeakMeasuredValue & PeakMeasuredValueWindow in AttributeList " + @"Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckThatPeakMeasuredValuePeakMeasuredValueWindowAreExcludedFromAttributeListWhenTvocconcsf04PeaIsNotSet_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that PeakMeasuredValue & PeakMeasuredValueWindow are excluded from AttributeList when TVOCCONC.S.F04 " + @"(PEA) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributesAverageMeasuredValueAverageMeasuredValueWindowInAttributeList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attributes AverageMeasuredValue AverageMeasuredValueWindow in " + @"AttributeList Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestCheckThatAverageMeasuredValueAndAverageMeasuredValueWindowAreExcludedFromAttributeListWhenTvocconcsf05AvgIsNotSet_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that AverageMeasuredValue and AverageMeasuredValueWindow are excluded from AttributeList when " + @"TVOCCONC.S.F05 (AVG) is not set Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 6UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalFeatureDependentAttributeLevelValueInAttributeList_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional, feature dependent attribute LevelValue in AttributeList 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 TestCheckThatLevelValueIsExcludedFromAttributeListWhenTvocconcsf01LevIsNotSet_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check that LevelValue is excluded from AttributeList when TVOCCONC.S.F01 (LEV) is not set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintExcludes("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeEventList_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: EventList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList 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 TestReadTheGlobalAttributeGeneratedCommandList_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList 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_TVOCCONC_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_TVOCCONC_2_1() + : TestCommandBridge("Test_TC_TVOCCONC_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_TVOCCONC_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TVOCCONC_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TVOCCONC_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 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the MinMeasuredValue attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMinMeasuredValueAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the MaxMeasuredValue attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the MeasuredValue attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasuredValueAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the PeakMeasuredValue attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the PeakMeasuredValueWindow attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AverageMeasuredValue attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AverageMeasuredValueWindow attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the MeasurementUnit attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementUnitAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the MeasurementMedium attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheMeasurementMediumAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the LevelValue attribute.\n"); + if (ShouldSkip("TVOCCONC.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheLevelValueAttribute_10(); + 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; + } + + // 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 = 11; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSNumber * _Nullable MinMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMinMeasuredValueAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MinMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value floatValue], 0.0f)); + } + { + MinMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable MaxMeasuredValue; + + CHIP_ERROR TestThReadsFromTheDutTheMaxMeasuredValueAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MaxMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value floatValue], MinMeasuredValue)); + } + { + MaxMeasuredValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasuredValueAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("measuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("peakMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutThePeakMeasuredValueWindowAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the PeakMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("peakMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("peakMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("peakMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("averageMeasuredValue", "single", "single")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValue", [value floatValue], MinMeasuredValue)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValue", [value floatValue], MaxMeasuredValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAverageMeasuredValueWindowAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AverageMeasuredValueWindow attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("averageMeasuredValueWindow", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("averageMeasuredValueWindow", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("averageMeasuredValueWindow", [value unsignedIntValue], 259200UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementUnitAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementUnit attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementUnit", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementUnit", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementUnit", [value unsignedCharValue], 7U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheMeasurementMediumAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the MeasurementMedium attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("measurementMedium", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("measurementMedium", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measurementMedium", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheLevelValueAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = + [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the LevelValue attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("levelValue", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("levelValue", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("levelValue", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_OPCREDS_1_2 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -147995,6 +163100,26 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),