From 1069066d1ba48b60317f9c2e0596505343a714af Mon Sep 17 00:00:00 2001 From: Vikram Bhat Date: Wed, 3 Nov 2021 22:11:56 +0530 Subject: [PATCH] Adding YAML Test Cases - Nov 2nd (#11364) * Adding Test Cases 1.Test_TC_BI_2_1 2.Test_TC_CC_9_2 3.Test_TC_CC_9_3 4.Test_TC_OCC_2_2 5.Test_TC_LVL_4_1 6.Test_TC_LVL_5_1 7.Test_TC_PRS_1_1 8.Test_TC_PRS_2_1 9.Test_TC_RH_2_2 10.Test_TC_TM_2_2 11.Test_TC_TSUIC_2_2 12.Test_TC_WNCV_2_5 13.Test_TC_DIAGSW_1_1 * Updating generated test script artifacts. * Disabling Failing Test Step --- examples/chip-tool/templates/tests.js | 21 + .../suites/certification/Test_TC_BI_2_1.yaml | 283 + .../suites/certification/Test_TC_CC_9_2.yaml | 221 + .../suites/certification/Test_TC_CC_9_3.yaml | 220 + .../certification/Test_TC_DIAGSW_1_1.yaml | 56 + .../suites/certification/Test_TC_LVL_4_1.yaml | 115 + .../suites/certification/Test_TC_LVL_5_1.yaml | 97 + .../suites/certification/Test_TC_OCC_2_2.yaml | 54 + .../suites/certification/Test_TC_PRS_1_1.yaml | 175 + .../suites/certification/Test_TC_PRS_2_1.yaml | 222 + .../suites/certification/Test_TC_RH_2_2.yaml | 54 + .../suites/certification/Test_TC_TM_2_2.yaml | 54 + .../certification/Test_TC_TSUIC_2_2.yaml | 161 + .../certification/Test_TC_WNCV_2_5.yaml | 35 + src/darwin/Framework/CHIP/templates/tests.js | 21 + .../Framework/CHIPTests/CHIPClustersTests.m | 2455 +++- .../chip-tool/zap-generated/test/Commands.h | 10862 ++++++++++------ 17 files changed, 11172 insertions(+), 3934 deletions(-) create mode 100644 src/app/tests/suites/certification/Test_TC_BI_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_CC_9_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_CC_9_3.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_DIAGSW_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_PRS_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_PRS_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_RH_2_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_TM_2_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_TSUIC_2_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WNCV_2_5.yaml diff --git a/examples/chip-tool/templates/tests.js b/examples/chip-tool/templates/tests.js index 127cb1eb515890..6761bcf000c358 100644 --- a/examples/chip-tool/templates/tests.js +++ b/examples/chip-tool/templates/tests.js @@ -19,6 +19,7 @@ function getTests() { const BinaryInput = [ 'Test_TC_BI_1_1', + 'Test_TC_BI_2_1', ]; const ColorControl = [ @@ -42,6 +43,8 @@ function getTests() 'Test_TC_CC_7_3', 'Test_TC_CC_7_4', 'Test_TC_CC_8_1', + 'Test_TC_CC_9_2', + 'Test_TC_CC_9_3', ]; const DeviceManagement = [ @@ -62,12 +65,15 @@ function getTests() const OccupancySensing = [ 'Test_TC_OCC_1_1', 'Test_TC_OCC_2_1', + 'Test_TC_OCC_2_2', ]; const LevelControl = [ 'Test_TC_LVL_1_1', 'Test_TC_LVL_2_1', 'Test_TC_LVL_3_1', + 'Test_TC_LVL_4_1', + 'Test_TC_LVL_5_1', ]; const MediaControl = [ @@ -92,6 +98,11 @@ function getTests() 'Test_TC_OO_2_2', ]; + const PressureMeasurement = [ + 'Test_TC_PRS_1_1', + 'Test_TC_PRS_2_1', + ]; + const PumpConfigurationControl = [ 'Test_TC_PCC_1_1', 'Test_TC_PCC_2_1', @@ -102,11 +113,13 @@ function getTests() const RelativeHumidityMeasurement = [ 'Test_TC_RH_1_1', 'Test_TC_RH_2_1', + 'Test_TC_RH_2_2', ]; const TemperatureMeasurement = [ 'Test_TC_TM_1_1', 'Test_TC_TM_2_1', + 'Test_TC_TM_2_2', ]; const Thermostat = [ @@ -116,6 +129,7 @@ function getTests() const ThermostatUserConfiguration = [ 'Test_TC_TSUIC_1_1', 'Test_TC_TSUIC_2_1', + 'Test_TC_TSUIC_2_2', ]; const ThreadNetworkDiagnostics = [ @@ -125,6 +139,7 @@ function getTests() const WindowCovering = [ 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', + 'Test_TC_WNCV_2_5', 'Test_TC_WNCV_3_1', 'Test_TC_WNCV_3_2', 'Test_TC_WNCV_3_3', @@ -157,6 +172,10 @@ function getTests() 'TestModeSelectCluster', ]; + const SoftwareDiagnostics = [ + 'Test_TC_DIAGSW_1_1', + ]; + const Subscriptions = [ 'TestSubscribe_OnOff', ]; @@ -171,6 +190,7 @@ function getTests() MediaControl, // OccupancySensing, // OnOff, // + PressureMeasurement, // PumpConfigurationControl, // RelativeHumidityMeasurement, // TemperatureMeasurement, // @@ -180,6 +200,7 @@ function getTests() WindowCovering, // TV, // Others, // + SoftwareDiagnostics, // Subscriptions, // ]; return tests.flat(1); diff --git a/src/app/tests/suites/certification/Test_TC_BI_2_1.yaml b/src/app/tests/suites/certification/Test_TC_BI_2_1.yaml new file mode 100644 index 00000000000000..4af977b998213a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_BI_2_1.yaml @@ -0,0 +1,283 @@ +# 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: 18.2.1. [TC-BI-2.1] Attributes with server as DUT + +config: + cluster: "Binary Input (Basic)" + endpoint: 1 + +tests: + - label: "Read mandatory non-global attribute: OutOfService" + command: "readAttribute" + attribute: "out of service" + response: + value: 0 + + - label: "Read mandatory non-global attribute constraints: OutOfService" + command: "readAttribute" + attribute: "out of service" + response: + constraints: + type: bool + + - label: + "Write the default values to mandatory non-global attribute: + OutOfService" + command: "writeAttribute" + attribute: "out of service" + arguments: + value: 0 + + - label: "Reads back the mandatory non-global attribute: OutOfService" + command: "readAttribute" + attribute: "out of service" + response: + value: 0 + + - label: "Read mandatory non-global attribute constraints: PresentValue" + command: "readAttribute" + attribute: "present value" + response: + constraints: + type: bool + + - label: + "Write the default values to mandatory non-global attribute: + PresentValue" + command: "writeAttribute" + attribute: "present value" + arguments: + value: 0 + + - label: "Reads back the mandatory non-global attribute: PresentValue" + command: "readAttribute" + attribute: "present value" + response: + value: 0 + + - label: "Read mandatory non-global attribute: StatusFlags" + command: "readAttribute" + attribute: "status flags" + response: + value: 0 + + - label: "Read mandatory non-global attribute constraints: StatusFlags" + command: "readAttribute" + attribute: "status flags" + response: + constraints: + type: map8 + minValue: 0 + maxValue: 15 + + - label: + "Write the default values to mandatory non-global attribute: + StatusFlags" + command: "writeAttribute" + attribute: "status flags" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back the mandatory non-global attribute: StatusFlags" + command: "readAttribute" + attribute: "status flags" + response: + value: 0 + + #Issue #11142 Disabled all optional attribute checks + - label: "Read optional non-global attribute: ActiveText" + disabled: true + command: "readAttribute" + attribute: "active text" + response: + value: null + + - label: "Read optional non-global attribute constraints: ActiveText" + disabled: true + command: "readAttribute" + attribute: "active text" + response: + constraints: + type: string + + - label: + "Write the default values to optional non-global attribute: ActiveText" + disabled: true + command: "writeAttribute" + attribute: "active text" + arguments: + value: null + + - label: "Reads back the optional non-global attribute: ActiveText" + disabled: true + command: "readAttribute" + attribute: "active text" + response: + value: null + + - label: "Read optional non-global attribute: Description" + disabled: true + command: "readAttribute" + attribute: "description" + response: + value: null + + - label: "Read optional non-global attribute constraints: Description" + disabled: true + command: "readAttribute" + attribute: "description" + response: + constraints: + type: string + + - label: + "Write the default values to optional non-global attribute: + Description" + disabled: true + command: "writeAttribute" + attribute: "description" + arguments: + value: null + + - label: "Reads back the optional non-global attribute: Description" + disabled: true + command: "readAttribute" + attribute: "description" + response: + value: null + + - label: "Read optional non-global attribute: InactiveText" + disabled: true + command: "readAttribute" + attribute: "inactive text" + response: + value: null + + - label: "Read optional non-global attribute constraints: InactiveText" + disabled: true + command: "readAttribute" + attribute: "inactive text" + response: + constraints: + type: string + + - label: + "Write the default values to optional non-global attribute: + InactiveText" + disabled: true + command: "writeAttribute" + attribute: "inactive text" + arguments: + value: null + + - label: "Reads back the optional non-global attribute: InactiveText" + disabled: true + command: "readAttribute" + attribute: "inactive text" + response: + value: null + + - label: "Read optional non-global attribute: Polarity" + disabled: true + command: "readAttribute" + attribute: "polarity" + response: + value: 0 + + - label: "Read optional non-global attribute constraints: Polarity" + disabled: true + command: "readAttribute" + attribute: "polarity" + response: + constraints: + type: enum8 + + - label: + "Write the default values to optional non-global attribute: Polarity" + disabled: true + command: "writeAttribute" + attribute: "polarity" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back the optional non-global attribute: Polarity" + disabled: true + command: "readAttribute" + attribute: "polarity" + response: + value: 0 + + - label: "Read optional non-global attribute: Reliability" + disabled: true + command: "readAttribute" + attribute: "reliability" + response: + value: 0 + + - label: "Read optional non-global attribute constraints: Reliability" + disabled: true + command: "readAttribute" + attribute: "reliability" + response: + constraints: + type: enum8 + + - label: + "Write the default values to optional non-global attribute: + Reliability" + disabled: true + command: "writeAttribute" + attribute: "reliability" + arguments: + value: 0 + + - label: "Reads back the optional non-global attribute: Reliability" + disabled: true + command: "readAttribute" + attribute: "reliability" + response: + value: 0 + + - label: "Read optional non-global attribute constraints: ApplicationType" + disabled: true + command: "readAttribute" + attribute: "application type" + response: + constraints: + type: uint32 + minValue: 0 + maxValue: 4294967295 + + - label: + "Write the default values to optional non-global attribute: + ApplicationType" + disabled: true + command: "writeAttribute" + attribute: "application type" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back the optional non-global attribute: ApplicationType" + disabled: true + command: "readAttribute" + attribute: "application type" + response: + value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_CC_9_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_9_2.yaml new file mode 100644 index 00000000000000..e5198e183ede03 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CC_9_2.yaml @@ -0,0 +1,221 @@ +# 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: + 27.2.21. [TC-CC-9.2] ColorLoopSet Validation - change direction without stop + +config: + cluster: "Color Control" + endpoint: 1 + +tests: + - label: "Precondition: Turn on light for color control tests" + cluster: "On/Off" + command: "on" + + - label: + "Precondition: Check on/off attribute value is true after on command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 15 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 30 + - name: "startHue" + value: 160 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 0 + + - label: "Read ColorLoopDirection attribute from DUT." + command: "readAttribute" + attribute: "color loop direction" + response: + value: 0 + + - label: "Read ColorLoopTime attribute from DUT." + command: "readAttribute" + attribute: "color loop time" + response: + value: 30 + + - label: "Read ColorLoopStartEnhancedHue attribute from DUT." + command: "readAttribute" + attribute: "color loop start enhanced hue" + response: + value: 160 + + - label: "Color Loop Set Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 1 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT." + command: "readAttribute" + attribute: "color loop active" + response: + value: 1 + + #Issue #10816 Need to store EnhancedCurrentHue value and compare it with ColorLoopStoredEnhancedHue attribute + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "color loop start enhanced hue" + response: + value: 500 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + - label: "Color Loop Set Command - Start Color Loop" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 2 + - name: "action" + value: 0 + - name: "direction" + value: 1 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopDirection attribute from DUT." + command: "readAttribute" + attribute: "color loop direction" + response: + value: 1 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + - label: "Color Loop Set Command - Start Color Loop" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 0 + + #Issue #10816 Need to store ColorLoopStoredEnhancedHue value and compare it with EnhancedCurrentHue attribute + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "color loop start enhanced hue" + response: + value: 0 + + - label: "Read EnhancedCurrentHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Turn off light for color control tests" + cluster: "On/Off" + command: "off" diff --git a/src/app/tests/suites/certification/Test_TC_CC_9_3.yaml b/src/app/tests/suites/certification/Test_TC_CC_9_3.yaml new file mode 100644 index 00000000000000..953810b628a7b6 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CC_9_3.yaml @@ -0,0 +1,220 @@ +# 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: 27.2.22. [TC-CC-9.3] ColorLoopSet Validation - change time without stop + +config: + cluster: "Color Control" + endpoint: 1 + +tests: + - label: "Precondition: Turn on light for color control tests" + cluster: "On/Off" + command: "on" + + - label: + "Precondition: Check on/off attribute value is true after on command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 15 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 30 + - name: "startHue" + value: 160 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 0 + + - label: "Read ColorLoopDirection attribute from DUT." + command: "readAttribute" + attribute: "color loop direction" + response: + value: 0 + + - label: "Read ColorLoopTime attribute from DUT." + command: "readAttribute" + attribute: "color loop time" + response: + value: 30 + + - label: "Read ColorLoopStartEnhancedHue attribute from DUT." + command: "readAttribute" + attribute: "color loop start enhanced hue" + response: + value: 160 + + - label: "Color Loop Set Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 1 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT." + command: "readAttribute" + attribute: "color loop active" + response: + value: 1 + + #Issue #10816 Need to store EnhancedCurrentHue value and compare it with ColorLoopStoredEnhancedHue attribute + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "color loop start enhanced hue" + response: + value: 0 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + - label: "Color Loop Set Command - Start Color Loop" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 4 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 60 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopTime attribute from DUT." + command: "readAttribute" + attribute: "color loop time" + response: + value: 60 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + # Test is disabled because a sleep/wait is necessary to let the hue change over time + # Once sleep/wait is available, test case will need to be adapted + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 500 + + - label: "Color Loop Set Command - Start Color Loop" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 0 + + #Issue #10816 Need to store ColorLoopStoredEnhancedHue value and compare it with EnhancedCurrentHue attribute + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "color loop start enhanced hue" + response: + value: 0 + + - label: "Read EnhancedCurrentHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Turn off light for color control tests" + cluster: "On/Off" + command: "off" diff --git a/src/app/tests/suites/certification/Test_TC_DIAGSW_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DIAGSW_1_1.yaml new file mode 100644 index 00000000000000..9682dfaad6613c --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_DIAGSW_1_1.yaml @@ -0,0 +1,56 @@ +# 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: 48.1.1. [TC-DIAGSW-1.1] Attributes with server as DUT + +config: + cluster: "Software Diagnostics" + endpoint: 1 + +tests: + #Issue #11185 Disabled as ThreadMetrics attribute missing + - label: + "Reads a list of ThreadMetrics struct non-global attribute from DUT." + disabled: true + optional: true + command: "readAttribute" + attribute: "ThreadMetrics" + response: + constraints: + value: 0 + + - label: "Reads CurrentHeapFree non-global attribute value from DUT" + command: "readAttribute" + attribute: "CurrentHeapFree" + optional: true + response: + constraints: + type: uint64 + + - label: "Reads CurrentHeapUsed non-global attribute value from DUT" + command: "readAttribute" + attribute: "CurrentHeapUsed" + optional: true + response: + constraints: + type: uint64 + + - label: + "Reads CurrentHeapHighWaterMark non-global attribute value from DUT" + command: "readAttribute" + attribute: "CurrentHeapHighWatermark" + optional: true + response: + constraints: + type: uint64 diff --git a/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml new file mode 100644 index 00000000000000..b3e70af3767622 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml @@ -0,0 +1,115 @@ +# 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: 24.4.1. [TC-LVL-4.1] Step Verification (DUT as Server) + +config: + cluster: "Level Control" + endpoint: 1 + +tests: + - label: "Sending on command" + cluster: "On/Off" + command: "on" + + - label: "Precondition: DUT level is set to 0x80" + command: "Step" + arguments: + values: + - name: "stepMode" + value: 0 + - name: "stepSize" + value: 128 + - name: "transitionTime" + value: 20 + - name: "optionMask" + value: 0 + - name: "optionOverride" + value: 0 + + - label: "Wait 3000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 3000 + + - label: "Reads current level attribute from DUT" + command: "readAttribute" + attribute: "current level" + response: + value: 128 + + - label: "Sends step down command to DUT" + command: "Step" + arguments: + values: + - name: "stepMode" + value: 1 + - name: "stepSize" + value: 64 + - name: "transitionTime" + value: 20 + - name: "optionMask" + value: 0 + - name: "optionOverride" + value: 0 + + - label: "Wait 3000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 3000 + + - label: "Reads current level attribute from DUT" + command: "readAttribute" + attribute: "current level" + response: + value: 64 + + - label: "Sends a Step up command" + command: "Step" + arguments: + values: + - name: "stepMode" + value: 0 + - name: "stepSize" + value: 64 + - name: "transitionTime" + value: 20 + - name: "optionMask" + value: 0 + - name: "optionOverride" + value: 0 + + - label: "Wait 3000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 3000 + + - label: "Reads current level attribute from DUT" + command: "readAttribute" + attribute: "current level" + response: + value: 128 + + - label: "Sending off command" + cluster: "On/Off" + command: "off" diff --git a/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml new file mode 100644 index 00000000000000..a8e58baa0d66e0 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml @@ -0,0 +1,97 @@ +# 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: 24.5.1. [TC-LVL-5.1] Stop Verification (DUT as Server) + +config: + cluster: "Level Control" + endpoint: 1 + +tests: + - label: "Sending on command" + cluster: "On/Off" + command: "on" + + - label: "Precondition: DUT level is set to 0x80" + command: "Step" + arguments: + values: + - name: "stepMode" + value: 0 + - name: "stepSize" + value: 128 + - name: "transitionTime" + value: 20 + - name: "optionMask" + value: 0 + - name: "optionOverride" + value: 0 + + - label: "Wait 3000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 3000 + + #Disabling as current level value read was returning null on darwin build. + - label: "Reads current level attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "current level" + response: + value: 128 + + - label: "Sends a move up command to DUT" + command: "Move" + arguments: + values: + - name: "moveMode" + value: 0 + - name: "rate" + value: 1 + - name: "optionMask" + value: 1 + - name: "optionOverride" + value: 1 + + - label: "Wait 3000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 3000 + + - label: "Sends stop command to DUT" + command: "Stop" + arguments: + values: + - name: "optionMask" + value: 0 + - name: "optionOverride" + value: 0 + + #Disabling as current level value read was inconsistent when running test case multiple times. + - label: "Reads current level attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "current level" + response: + value: 133 + + - label: "Sending off command" + cluster: "On/Off" + command: "off" diff --git a/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml b/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml new file mode 100644 index 00000000000000..208a16f9b46d3d --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml @@ -0,0 +1,54 @@ +# 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: 30.2.2. [TC-OCC-2.2] Primary functionality with server as DUT + +config: + cluster: "Occupancy Sensing" + endpoint: 1 + +tests: + #Issue #10816 Disabled as values needs to be stored for comparison + - label: "Reads Occupancy attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "occupancy" + response: + value: 0 + + - label: "Reads Occupancy attribute from DUT" + command: "readAttribute" + attribute: "occupancy" + response: + constraints: + type: map8 + + #Issue #10815 Disabled as UI prompts required for user action + - label: "Operate on DUT to change the occupancy status" + disabled: true + + #Issue #10816 Disabled as values needs to be compared with the value read in step 2 + - label: "Reads back Occupancy attribute from DUT after few seconds" + disabled: true + command: "readAttribute" + attribute: "occupancy" + response: + value: 0 + + - label: "Reads Occupancy attribute from DUT" + command: "readAttribute" + attribute: "occupancy" + response: + constraints: + type: map8 diff --git a/src/app/tests/suites/certification/Test_TC_PRS_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PRS_1_1.yaml new file mode 100644 index 00000000000000..f933fa94faf83d --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_PRS_1_1.yaml @@ -0,0 +1,175 @@ +# 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: 36.1.1. [TC-PRS-1.1] Global attributes with server as DUT + +config: + cluster: "Pressure Measurement" + endpoint: 1 + +tests: + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 2 + + - label: "Read the global attribute constraints: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + constraints: + type: uint16 + + - label: + "Write the default values to mandatory global attribute: + ClusterRevision" + command: "writeAttribute" + attribute: "ClusterRevision" + arguments: + value: 2 + response: + error: 1 + + - label: "Reads back global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 2 + + - label: "Read the mandatory global attribute: AttributeList" + disabled: true + command: "readAttribute" + attribute: "AttributeList" + response: + value: 0 + + - label: "Read the global attribute constraints: AttributeList" + disabled: true + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + + - label: + "Write the default values to mandatory global attribute: AttributeList" + disabled: true + command: "writeAttribute" + attribute: "AttributeList" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back mandatory global attribute: AttributeList" + disabled: true + command: "readAttribute" + attribute: "AttributeList" + response: + value: 0 + + - label: "Read the mandatory global attribute: CommandList" + disabled: true + command: "readAttribute" + attribute: "CommandList" + response: + value: 0 + + - label: "Read the global attribute constraints: CommandList" + disabled: true + command: "readAttribute" + attribute: "CommandList" + response: + constraints: + type: list + + - label: + "Write the default values to mandatory global attribute: CommandList" + disabled: true + command: "writeAttribute" + attribute: "CommandList" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back mandatory global attribute: CommandList" + disabled: true + command: "readAttribute" + attribute: "CommandList" + response: + value: 0 + + - label: "Read the mandatory global attribute: EventList" + disabled: true + command: "readAttribute" + attribute: "EventList" + response: + value: 0 + + - label: "Read the global attribute constraints: EventList" + disabled: true + command: "readAttribute" + attribute: "EventList" + response: + constraints: + type: list + + - label: "Write the default values to mandatory global attribute: EventList" + disabled: true + command: "writeAttribute" + attribute: "EventList" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back mandatory global attribute: EventList" + disabled: true + command: "readAttribute" + attribute: "EventList" + response: + value: 0 + + - label: "Read the optional global attribute: FeatureMap" + disabled: true + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 0 + + - label: "Read the optional global attribute constraints: FeatureMap" + disabled: true + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: map32 + + - label: "Write the default values to optional global attribute: FeatureMap" + disabled: true + command: "writeAttribute" + attribute: "FeatureMap" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back optional global attribute: FeatureMap" + disabled: true + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_PRS_2_1.yaml b/src/app/tests/suites/certification/Test_TC_PRS_2_1.yaml new file mode 100644 index 00000000000000..6cd4ff6ec99522 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_PRS_2_1.yaml @@ -0,0 +1,222 @@ +# 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: 36.2.1. [TC-PRS-2.1] Attributes with server as DUT + +config: + cluster: "Pressure Measurement" + endpoint: 1 + +tests: + - label: "Read the mandatory attribute constraints: MeasuredValue" + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: int16 + + - label: "Write the default values to mandatory attribute: MeasuredValue" + command: "writeAttribute" + attribute: "MeasuredValue" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back mandatory attribute: MeasuredValue" + command: "readAttribute" + attribute: "MeasuredValue" + response: + value: 0 + + - label: "Read the mandatory attribute constraints: MinMeasuredValue" + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + constraints: + type: int16 + + - label: "Write the default values to mandatory attribute: MinMeasuredValue" + command: "writeAttribute" + attribute: "MinMeasuredValue" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back mandatory attribute: MinMeasuredValue" + command: "readAttribute" + attribute: "MinMeasuredValue" + response: + value: 0 + + - label: "Read the mandatory attribute constraints: MaxMeasuredValue" + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + constraints: + type: int16 + + - label: "Write the default values to mandatory attribute: MaxMeasuredValue" + command: "writeAttribute" + attribute: "MaxMeasuredValue" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back mandatory attribute: MaxMeasuredValue" + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + value: 0 + + - label: "Read the optional attribute: Tolerance" + disabled: true + command: "readAttribute" + attribute: "Tolerance" + response: + value: 0 + + - label: "Write the default values to optional attribute: Tolerance" + disabled: true + command: "writeAttribute" + attribute: "Tolerance" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back optional attribute: Tolerance" + disabled: true + command: "readAttribute" + attribute: "Tolerance" + response: + value: 0 + + #Following attributes are based on the value of the extended feature in the cluster feature map + - label: "Read the optional attribute: ScaledValue" + disabled: true + command: "readAttribute" + attribute: "ScaledValue" + response: + value: 0 + + - label: "Write the default values to optional attribute: ScaledValue" + disabled: true + command: "writeAttribute" + attribute: "ScaledValue" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back optional attribute: ScaledValue" + disabled: true + command: "readAttribute" + attribute: "ScaledValue" + response: + value: 0 + + - label: "Read the optional attribute: MinScaledValue" + disabled: true + command: "readAttribute" + attribute: "MinScaledValue" + response: + value: 0 + + - label: "Write the default values to optional attribute: MinScaledValue" + disabled: true + command: "writeAttribute" + attribute: "MinScaledValue" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back optional attribute: MinScaledValue" + disabled: true + command: "readAttribute" + attribute: "MinScaledValue" + response: + value: 0 + + - label: "Read the optional attribute: MaxScaledValue" + disabled: true + command: "readAttribute" + attribute: "MaxScaledValue" + response: + value: 0 + + - label: "Write the default values to optional attribute: MaxScaledValue" + disabled: true + command: "writeAttribute" + attribute: "MaxScaledValue" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back optional attribute: MaxScaledValue" + disabled: true + command: "readAttribute" + attribute: "MaxScaledValue" + response: + value: 0 + + - label: "Read the optional attribute: ScaledTolerance" + disabled: true + command: "readAttribute" + attribute: "ScaledTolerance" + response: + value: 0 + + - label: "Write the default values to optional attribute: ScaledTolerance" + disabled: true + command: "writeAttribute" + attribute: "ScaledTolerance" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back optional attribute: ScaledTolerance" + disabled: true + command: "readAttribute" + attribute: "ScaledTolerance" + response: + value: 0 + + - label: "Read the optional attribute: Scale" + disabled: true + command: "readAttribute" + attribute: "Scale" + response: + value: 0 + + - label: "Write the default values to optional attribute: Scale" + disabled: true + command: "writeAttribute" + attribute: "Scale" + arguments: + value: 0 + response: + error: 1 + + - label: "Reads back optional attribute: Scale" + disabled: true + command: "readAttribute" + attribute: "Scale" + response: + value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_RH_2_2.yaml b/src/app/tests/suites/certification/Test_TC_RH_2_2.yaml new file mode 100644 index 00000000000000..f3013ffe38db9f --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_RH_2_2.yaml @@ -0,0 +1,54 @@ +# 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: 9.2.2. [TC-RH-2.2] Primary functionality with server as DUT + +config: + cluster: "Relative Humidity Measurement" + endpoint: 1 + +tests: + #Disabled as values needs to be stored for comparison + - label: "Reads MeasuredValue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "measured value" + response: + value: 0 + + - label: "Reads MeasuredValue attribute from DUT" + command: "readAttribute" + attribute: "measured value" + response: + constraints: + type: uint16 + + #Disabled as UI prompts required for user action + - label: "Operate on device to change the relative humidity significantly" + disabled: true + + #Disabled as values needs to be compared with the value read in step 2 + - label: "Reads back MeasuredValue attribute from DUT after few seconds" + disabled: true + command: "readAttribute" + attribute: "measured value" + response: + value: 0 + + - label: "Read the mandatory attribute: MeasuredValue" + command: "readAttribute" + attribute: "measured value" + response: + constraints: + type: uint16 diff --git a/src/app/tests/suites/certification/Test_TC_TM_2_2.yaml b/src/app/tests/suites/certification/Test_TC_TM_2_2.yaml new file mode 100644 index 00000000000000..8be5cc689de372 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_TM_2_2.yaml @@ -0,0 +1,54 @@ +# 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: 6.2.2. [TC-TM-2.2] Primary functionality with server as DUT + +config: + cluster: "Temperature Measurement" + endpoint: 1 + +tests: + #Disabled as values needs to be stored for comparison + - label: "Reads MeasuredValue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "MeasuredValue" + response: + value: 0 + + - label: "Reads MeasuredValue attribute from DUT" + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: uint16 + + #Disabled as UI prompts required for user action + - label: "Operate on device to change the temperature significantly" + disabled: true + + #Disabled as values needs to be compared with the value read in step 2 + - label: "Reads back MeasuredValue attribute from DUT after few seconds" + disabled: true + command: "readAttribute" + attribute: "MeasuredValue" + response: + value: 0 + + - label: "Read the mandatory attribute: MeasuredValue" + command: "readAttribute" + attribute: "MeasuredValue" + response: + constraints: + type: uint16 diff --git a/src/app/tests/suites/certification/Test_TC_TSUIC_2_2.yaml b/src/app/tests/suites/certification/Test_TC_TSUIC_2_2.yaml new file mode 100644 index 00000000000000..4d72eb5256613c --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_TSUIC_2_2.yaml @@ -0,0 +1,161 @@ +# 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: 12.2.2. [TC-TSUIC-2.2] Primary functionality with server as DUT + +config: + cluster: "Thermostat User Interface Configuration" + endpoint: 1 + +tests: + - label: "Writes a value of 0 to TemperatureDisplayMode attribute of DUT" + command: "writeAttribute" + attribute: "temperature display mode" + arguments: + value: 0 + + #Disabled as UI prompts required for user action + - label: "Verify device temperature displayed in °C" + disabled: true + + - label: "Writes a value of 1 to TemperatureDisplayMode attribute of DUT" + command: "writeAttribute" + attribute: "temperature display mode" + arguments: + value: 1 + + #Disabled as UI prompts required for user action + - label: "Verify device temperature displayed in °F" + disabled: true + + #Disabled as write was successful + - label: + "Writes a value of greater than 1 to TemperatureDisplayMode attribute + of DUT" + disabled: true + command: "writeAttribute" + attribute: "temperature display mode" + arguments: + value: 2 + response: + error: 135 + + - label: "Writes a value of 0 to KeypadLockout attribute of DUT" + command: "writeAttribute" + attribute: "keypad lockout" + arguments: + value: 0 + + #Disabled as UI prompts required for user action + - label: "Verify all device functionality available to the user" + disabled: true + + - label: "Writes a value of 1 to KeypadLockout attribute of DUT" + command: "writeAttribute" + attribute: "keypad lockout" + arguments: + value: 1 + + #Disabled as UI prompts required for user action + - label: "Verify device operates at Level 1 reduced functionality" + disabled: true + + - label: "Writes a value of 2 to KeypadLockout attribute of DUT" + command: "writeAttribute" + attribute: "keypad lockout" + arguments: + value: 2 + + #Disabled as UI prompts required for user action + - label: "Verify device operates at Level 2 reduced functionality" + disabled: true + + - label: "Writes a value of 3 to KeypadLockout attribute of DUT" + command: "writeAttribute" + attribute: "keypad lockout" + arguments: + value: 3 + + #Disabled as UI prompts required for user action + - label: "Verify device operates at Level 3 reduced functionality" + disabled: true + + - label: "Writes a value of 4 to KeypadLockout attribute of DUT" + command: "writeAttribute" + attribute: "keypad lockout" + arguments: + value: 4 + + #Disabled as UI prompts required for user action + - label: "Verify device operates at Level 4 reduced functionality" + disabled: true + + - label: "Writes a value of 5 to KeypadLockout attribute of DUT" + command: "writeAttribute" + attribute: "keypad lockout" + arguments: + value: 5 + + #Disabled as UI prompts required for user action + - label: "Verify device operates at least functionality level" + disabled: true + + #Disabled as write was successful + - label: + "Writes a value of greater than 5 to KeypadLockout attribute of DUT" + disabled: true + command: "writeAttribute" + attribute: "keypad lockout" + arguments: + value: 6 + response: + error: 135 + + - label: + "Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT" + command: "writeAttribute" + attribute: "schedule programming visibility" + arguments: + value: 0 + + #Disabled as UI prompts required for user action + - label: + "Verify local schedule programming functionality is enabled at the + thermostat" + disabled: true + + - label: + "Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT" + command: "writeAttribute" + attribute: "schedule programming visibility" + arguments: + value: 1 + + #Disabled as UI prompts required for user action + - label: + "Verify local schedule programming functionality is disabled at the + thermostat" + disabled: true + + #Disabled as write was successful + - label: + "Writes a value of greater than 1 to ScheduleProgrammingVisibility + attribute of DUT" + disabled: true + command: "writeAttribute" + attribute: "schedule programming visibility" + arguments: + value: 2 + response: + error: 135 diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_2_5.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_2_5.yaml new file mode 100644 index 00000000000000..a04387c800208a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WNCV_2_5.yaml @@ -0,0 +1,35 @@ +# 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: 39.2.5. [TC-WNCV-2.5] EndProductType Attribute with server as DUT + +config: + cluster: "Window Covering" + endpoint: 1 + +tests: + - label: "Reads EndProductType attribute from DUT" + command: "readAttribute" + attribute: "EndProductType" + response: + value: 0 + + - label: "Reads EndProductType attribute constraints from DUT" + command: "readAttribute" + attribute: "EndProductType" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 23 diff --git a/src/darwin/Framework/CHIP/templates/tests.js b/src/darwin/Framework/CHIP/templates/tests.js index f9078254f4d382..a9e45da0fd3711 100644 --- a/src/darwin/Framework/CHIP/templates/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests.js @@ -19,6 +19,7 @@ function getTests() { const BinaryInput = [ 'Test_TC_BI_1_1', + 'Test_TC_BI_2_1', ]; const ColorControl = [ @@ -42,6 +43,8 @@ function getTests() 'Test_TC_CC_7_3', 'Test_TC_CC_7_4', 'Test_TC_CC_8_1', + 'Test_TC_CC_9_2', + 'Test_TC_CC_9_3', ]; const DeviceManagement = [ @@ -62,12 +65,15 @@ function getTests() const OccupancySensing = [ 'Test_TC_OCC_1_1', 'Test_TC_OCC_2_1', + 'Test_TC_OCC_2_2', ]; const LevelControl = [ 'Test_TC_LVL_1_1', 'Test_TC_LVL_2_1', 'Test_TC_LVL_3_1', + 'Test_TC_LVL_4_1', + 'Test_TC_LVL_5_1', ]; const MediaControl = [ @@ -92,6 +98,11 @@ function getTests() 'Test_TC_OO_2_2', ]; + const PressureMeasurement = [ + 'Test_TC_PRS_1_1', + 'Test_TC_PRS_2_1', + ]; + const PumpConfigurationControl = [ 'Test_TC_PCC_1_1', 'Test_TC_PCC_2_1', @@ -102,11 +113,13 @@ function getTests() const RelativeHumidityMeasurement = [ 'Test_TC_RH_1_1', 'Test_TC_RH_2_1', + 'Test_TC_RH_2_2', ]; const TemperatureMeasurement = [ 'Test_TC_TM_1_1', 'Test_TC_TM_2_1', + 'Test_TC_TM_2_2', ]; const Thermostat = [ @@ -116,6 +129,7 @@ function getTests() const ThermostatUserConfiguration = [ 'Test_TC_TSUIC_1_1', 'Test_TC_TSUIC_2_1', + 'Test_TC_TSUIC_2_2', ]; const ThreadNetworkDiagnostics = [ @@ -125,6 +139,7 @@ function getTests() const WindowCovering = [ 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', + 'Test_TC_WNCV_2_5', 'Test_TC_WNCV_3_1', 'Test_TC_WNCV_3_2', 'Test_TC_WNCV_3_3', @@ -141,6 +156,10 @@ function getTests() 'TestModeSelectCluster', ]; + const SoftwareDiagnostics = [ + 'Test_TC_DIAGSW_1_1', + ]; + const Subscriptions = [ 'TestSubscribe_OnOff', ]; @@ -155,6 +174,7 @@ function getTests() MediaControl, // OccupancySensing, // OnOff, // + PressureMeasurement, // PumpConfigurationControl, // RelativeHumidityMeasurement, // TemperatureMeasurement, // @@ -163,6 +183,7 @@ function getTests() ThreadNetworkDiagnostics, // WindowCovering, // Others, // + SoftwareDiagnostics, // Subscriptions, // ]; return tests.flat(1); diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 525e7caee330c5..07a13a6ff25e90 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -249,6 +249,245 @@ - (void)testSendClusterTest_TC_BI_1_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_BI_2_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read mandatory non-global attribute: OutOfService"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOutOfServiceWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read mandatory non-global attribute: OutOfService Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Read mandatory non-global attribute constraints: OutOfService"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOutOfServiceWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read mandatory non-global attribute constraints: OutOfService Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000002_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Write the default values to mandatory non-global attribute: OutOfService"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + bool outOfServiceArgument = 0; + [cluster + writeAttributeOutOfServiceWithValue:outOfServiceArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write the default values to mandatory non-global attribute: OutOfService Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads back the mandatory non-global attribute: OutOfService"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOutOfServiceWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back the mandatory non-global attribute: OutOfService Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Read mandatory non-global attribute constraints: PresentValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributePresentValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read mandatory non-global attribute constraints: PresentValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000005_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Write the default values to mandatory non-global attribute: PresentValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + bool presentValueArgument = 0; + [cluster + writeAttributePresentValueWithValue:presentValueArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write the default values to mandatory non-global attribute: PresentValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads back the mandatory non-global attribute: PresentValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributePresentValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back the mandatory non-global attribute: PresentValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000007_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read mandatory non-global attribute: StatusFlags"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeStatusFlagsWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read mandatory non-global attribute: StatusFlags Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Read mandatory non-global attribute constraints: StatusFlags"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeStatusFlagsWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read mandatory non-global attribute constraints: StatusFlags Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 15); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000009_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Write the default values to mandatory non-global attribute: StatusFlags"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t statusFlagsArgument = 0; + [cluster + writeAttributeStatusFlagsWithValue:statusFlagsArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write the default values to mandatory non-global attribute: StatusFlags Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BI_2_1_000010_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads back the mandatory non-global attribute: StatusFlags"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBinaryInputBasic * cluster = [[CHIPTestBinaryInputBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeStatusFlagsWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back the mandatory non-global attribute: StatusFlags Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_CC_1_1_000000_WriteAttribute { XCTestExpectation * expectation = @@ -6048,17 +6287,17 @@ - (void)testSendClusterTest_TC_CC_8_1_000015_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000000_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Interaction Model Version"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeInteractionModelVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Interaction Model Version Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6067,82 +6306,762 @@ - (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Vendor Name"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeVendorNameWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Vendor Name Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] length], 32); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000002_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query VendorID"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeVendorIDWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query VendorID Error: %@", err); + uint8_t updateFlagsArgument = 15; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 30U; + uint16_t startHueArgument = 160U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Product Name"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeProductNameWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Product Name Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] length], 32); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductID"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeProductIDWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query ProductID Error: %@", err); + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); - [expectation fulfill]; + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000007_ColorLoopSet +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 1; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t updateFlagsArgument = 2; + uint8_t actionArgument = 0; + uint8_t directionArgument = 1; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000011_ColorLoopSet +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000012_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000013_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn off light for color control tests Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_CC_9_3_000000_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000001_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Check on/off attribute value is true after on command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000002_ColorLoopSet +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t updateFlagsArgument = 15; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 30U; + uint16_t startHueArgument = 160U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 1; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000009_ColorLoopSet +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t updateFlagsArgument = 4; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 60U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 60U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000011_ColorLoopSet +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster colorLoopSet:updateFlagsArgument + action:actionArgument + direction:directionArgument + time:timeArgument + startHue:startHueArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000012_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_3_000013_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn off light for color control tests Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Interaction Model Version"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeInteractionModelVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Interaction Model Version Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Vendor Name"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeVendorNameWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Vendor Name Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] length], 32); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query VendorID"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeVendorIDWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query VendorID Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Product Name"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeProductNameWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Product Name Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] length], 32); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductID"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeProductIDWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query ProductID Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; @@ -6943,59 +7862,312 @@ - (void)testSendClusterTest_TC_LVL_2_1_000009_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 10ms"]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 10); + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 10); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current Level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 254); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000011_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 0"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t levelArgument = 0; + uint16_t transitionTimeArgument = 0U; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster moveToLevel:levelArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reset level to 0 Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000012_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_3_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads max level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads max level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000002_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t moveModeArgument = 0; + uint8_t rateArgument = 200; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster move:moveModeArgument + rate:rateArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move up command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000003_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads min level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads min level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000006_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move down command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t moveModeArgument = 1; + uint8_t rateArgument = 250; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster move:moveModeArgument + rate:rateArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move down command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000007_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000009_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write default move rate attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t defaultMoveRateArgument = 20; + [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write default move rate attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_LVL_3_1_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads default move rate attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeDefaultMoveRateWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads default move rate attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 254); + XCTAssertEqual([values[@"value"] unsignedCharValue], 20); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000011_MoveToLevel +- (void)testSendClusterTest_TC_LVL_3_1_000011_Move { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 0"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command at default move rate"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t levelArgument = 0; - uint16_t transitionTimeArgument = 0U; + uint8_t moveModeArgument = 1; + uint8_t rateArgument = 255; uint8_t optionMaskArgument = 1; uint8_t optionOverrideArgument = 1; - [cluster moveToLevel:levelArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reset level to 0 Error: %@", err); + [cluster move:moveModeArgument + rate:rateArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move up command at default move rate Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000012_WaitForMs +- (void)testSendClusterTest_TC_LVL_3_1_000012_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; @@ -7003,8 +8175,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000012_WaitForMs WaitForMs(expectation, queue, 100); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_LVL_3_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; @@ -7018,53 +8189,54 @@ - (void)testSendClusterTest_TC_LVL_3_1_000000_ReadAttribute XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertNotEqual([values[@"value"] unsignedCharValue], 255); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000001_ReadAttribute + +- (void)testSendClusterTest_TC_LVL_4_1_000000_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads max level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads max level attribute from DUT Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending on command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 255); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000002_Move +- (void)testSendClusterTest_TC_LVL_4_1_000001_Step { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t moveModeArgument = 0; - uint8_t rateArgument = 200; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster move:moveModeArgument - rate:rateArgument + uint8_t stepModeArgument = 0; + uint8_t stepSizeArgument = 128; + uint16_t transitionTimeArgument = 20U; + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster step:stepModeArgument + stepSize:stepSizeArgument + transitionTime:transitionTimeArgument optionMask:optionMaskArgument optionOverride:optionOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move up command Error: %@", err); + NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7073,7 +8245,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000002_Move [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000003_WaitForMs +- (void)testSendClusterTest_TC_LVL_4_1_000002_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; @@ -7081,9 +8253,9 @@ - (void)testSendClusterTest_TC_LVL_3_1_000003_WaitForMs WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_LVL_4_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -7091,57 +8263,96 @@ - (void)testSendClusterTest_TC_LVL_3_1_000004_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + NSLog(@"Reads current level attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + XCTAssertEqual([values[@"value"] unsignedCharValue], 128); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_LVL_4_1_000004_Step { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads min level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step down command to DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads min level attribute from DUT Error: %@", err); + uint8_t stepModeArgument = 1; + uint8_t stepSizeArgument = 64; + uint16_t transitionTimeArgument = 20U; + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster step:stepModeArgument + stepSize:stepSizeArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends step down command to DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000005_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 64); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000006_Move +- (void)testSendClusterTest_TC_LVL_4_1_000007_Step { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move down command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step up command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t moveModeArgument = 1; - uint8_t rateArgument = 250; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster move:moveModeArgument - rate:rateArgument + uint8_t stepModeArgument = 0; + uint8_t stepSizeArgument = 64; + uint16_t transitionTimeArgument = 20U; + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster step:stepModeArgument + stepSize:stepSizeArgument + transitionTime:transitionTimeArgument optionMask:optionMaskArgument optionOverride:optionOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move down command Error: %@", err); + NSLog(@"Sends a Step up command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7150,7 +8361,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000006_Move [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000007_WaitForMs +- (void)testSendClusterTest_TC_LVL_4_1_000008_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; @@ -7158,9 +8369,9 @@ - (void)testSendClusterTest_TC_LVL_3_1_000007_WaitForMs WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -7168,70 +8379,104 @@ - (void)testSendClusterTest_TC_LVL_3_1_000008_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + NSLog(@"Reads current level attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 128); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000009_WriteAttribute +- (void)testSendClusterTest_TC_LVL_4_1_000010_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Write default move rate attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t defaultMoveRateArgument = 20; - [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Write default move rate attribute from DUT Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending off command Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000010_ReadAttribute + +- (void)testSendClusterTest_TC_LVL_5_1_000000_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads default move rate attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeDefaultMoveRateWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads default move rate attribute from DUT Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending on command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 20); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000011_Move +- (void)testSendClusterTest_TC_LVL_5_1_000001_Step { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command at default move rate"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t moveModeArgument = 1; - uint8_t rateArgument = 255; + uint8_t stepModeArgument = 0; + uint8_t stepSizeArgument = 128; + uint16_t transitionTimeArgument = 20U; + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster step:stepModeArgument + stepSize:stepSizeArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000002_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000003_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a move up command to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t moveModeArgument = 0; + uint8_t rateArgument = 1; uint8_t optionMaskArgument = 1; uint8_t optionOverrideArgument = 1; [cluster move:moveModeArgument @@ -7239,7 +8484,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000011_Move optionMask:optionMaskArgument optionOverride:optionOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move up command at default move rate Error: %@", err); + NSLog(@"Sends a move up command to DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7248,29 +8493,50 @@ - (void)testSendClusterTest_TC_LVL_3_1_000011_Move [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000012_WaitForMs +- (void)testSendClusterTest_TC_LVL_5_1_000004_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); + WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute +- (void)testSendClusterTest_TC_LVL_5_1_000005_Stop { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends stop command to DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + uint8_t optionMaskArgument = 0; + uint8_t optionOverrideArgument = 0; + [cluster stop:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends stop command to DUT Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - XCTAssertNotEqual([values[@"value"] unsignedCharValue], 255); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000006_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending off command Error: %@", err); + + XCTAssertEqual(err.code, 0); [expectation fulfill]; }]; @@ -7557,8 +8823,47 @@ - (void)testSendClusterTest_TC_OCC_2_1_000008_ReadAttribute XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 1); - + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_OCC_2_2_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_2_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -8229,6 +9534,276 @@ - (void)testSendClusterTest_TC_OO_2_2_000013_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_PRS_1_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 2U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_1_1_000002_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 2U; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_1_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 2U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_PRS_2_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute constraints: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read the mandatory attribute constraints: MeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_2_1_000001_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Write the default values to mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + int16_t measuredValueArgument = 0; + [cluster writeAttributeMeasuredValueWithValue:measuredValueArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write the default values to mandatory attribute: MeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_2_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back mandatory attribute: MeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] shortValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_2_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Read the mandatory attribute constraints: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read the mandatory attribute constraints: MinMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_2_1_000004_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Write the default values to mandatory attribute: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + int16_t minMeasuredValueArgument = 0; + [cluster writeAttributeMinMeasuredValueWithValue:minMeasuredValueArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write the default values to mandatory attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_2_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back mandatory attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] shortValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_2_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Read the mandatory attribute constraints: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read the mandatory attribute constraints: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_2_1_000007_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Write the default values to mandatory attribute: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + int16_t maxMeasuredValueArgument = 0; + [cluster writeAttributeMaxMeasuredValueWithValue:maxMeasuredValueArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Write the default values to mandatory attribute: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PRS_2_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPressureMeasurement * cluster = [[CHIPTestPressureMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back mandatory attribute: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] shortValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_PCC_1_1_000000_WriteAttribute { XCTestExpectation * expectation = @@ -8605,8 +10180,51 @@ - (void)testSendClusterTest_TC_RH_2_1_000001_ReadAttribute XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] unsignedShortValue], 9999); - + XCTAssertLessThanOrEqual([values[@"value"] unsignedShortValue], 9999); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_RH_2_2_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads MeasuredValue attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads MeasuredValue attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_RH_2_2_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read the mandatory attribute: MeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + [expectation fulfill]; }]; @@ -8706,6 +10324,49 @@ - (void)testSendClusterTest_TC_TM_2_1_000000_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_TM_2_2_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads MeasuredValue attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads MeasuredValue attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_2_2_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read the mandatory attribute: MeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_TSTAT_1_1_000000_WriteAttribute { XCTestExpectation * expectation = @@ -8810,16 +10471,234 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000002_WriteAttribute responseHandler:^(NSError * err, NSDictionary * values) { NSLog(@"write to the mandatory attribute: TemperatureDisplayMode Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeTemperatureDisplayModeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeTemperatureDisplayModeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeKeypadLockoutWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeKeypadLockoutWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000007_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"write to the mandatory attribute: KeypadLockout"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t keypadLockoutArgument = 0; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write to the mandatory attribute: KeypadLockout Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeKeypadLockoutWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000009_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeKeypadLockoutWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000010_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeScheduleProgrammingVisibilityWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000011_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeScheduleProgrammingVisibilityWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_1_000012_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write to the mandatory attribute: ScheduleProgrammingVisibility"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t scheduleProgrammingVisibilityArgument = 0; + [cluster + writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write to the mandatory attribute: ScheduleProgrammingVisibility Error: %@", + err); + + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_1_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -8827,8 +10706,8 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000003_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeTemperatureDisplayModeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); + [cluster readAttributeScheduleProgrammingVisibilityWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); XCTAssertEqual(err.code, 0); @@ -8839,9 +10718,10 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_1_000014_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -8849,8 +10729,8 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000004_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeTemperatureDisplayModeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); + [cluster readAttributeScheduleProgrammingVisibilityWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); XCTAssertEqual(err.code, 0); @@ -8859,9 +10739,11 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000005_ReadAttribute + +- (void)testSendClusterTest_TC_TSUIC_2_2_000000_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes a value of 0 to TemperatureDisplayMode attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -8869,21 +10751,23 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000005_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeKeypadLockoutWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); - - XCTAssertEqual(err.code, 0); + uint8_t temperatureDisplayModeArgument = 0; + [cluster + writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes a value of 0 to TemperatureDisplayMode attribute of DUT Error: %@", err); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000001_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes a value of 1 to TemperatureDisplayMode attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -8891,19 +10775,22 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000006_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeKeypadLockoutWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + uint8_t temperatureDisplayModeArgument = 1; + [cluster + writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes a value of 1 to TemperatureDisplayMode attribute of DUT Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000007_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000002_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"write to the mandatory attribute: KeypadLockout"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 0 to KeypadLockout attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -8914,7 +10801,7 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000007_WriteAttribute uint8_t keypadLockoutArgument = 0; [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write to the mandatory attribute: KeypadLockout Error: %@", err); + NSLog(@"Writes a value of 0 to KeypadLockout attribute of DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -8923,9 +10810,9 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000007_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000003_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 1 to KeypadLockout attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -8933,21 +10820,21 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000008_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeKeypadLockoutWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); - - XCTAssertEqual(err.code, 0); + uint8_t keypadLockoutArgument = 1; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes a value of 1 to KeypadLockout attribute of DUT Error: %@", err); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000004_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 2 to KeypadLockout attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -8955,20 +10842,21 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000009_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeKeypadLockoutWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + uint8_t keypadLockoutArgument = 2; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes a value of 2 to KeypadLockout attribute of DUT Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000005_WriteAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 3 to KeypadLockout attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -8976,22 +10864,21 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000010_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeScheduleProgrammingVisibilityWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); - - XCTAssertEqual(err.code, 0); + uint8_t keypadLockoutArgument = 3; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes a value of 3 to KeypadLockout attribute of DUT Error: %@", err); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000011_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000006_WriteAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 4 to KeypadLockout attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -8999,20 +10886,21 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000011_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeScheduleProgrammingVisibilityWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); + uint8_t keypadLockoutArgument = 4; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes a value of 4 to KeypadLockout attribute of DUT Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000012_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000007_WriteAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write to the mandatory attribute: ScheduleProgrammingVisibility"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 5 to KeypadLockout attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9020,24 +10908,22 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000012_WriteAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t scheduleProgrammingVisibilityArgument = 0; - [cluster - writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write to the mandatory attribute: ScheduleProgrammingVisibility Error: %@", - err); + uint8_t keypadLockoutArgument = 5; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes a value of 5 to KeypadLockout attribute of DUT Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000013_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000008_WriteAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; + [self expectationWithDescription:@"Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9045,22 +10931,24 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000013_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeScheduleProgrammingVisibilityWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); - - XCTAssertEqual(err.code, 0); + uint8_t scheduleProgrammingVisibilityArgument = 0; + [cluster writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes a value of 0 to ScheduleProgrammingVisibility attribute of " + @"DUT Error: %@", + err); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000014_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000009_WriteAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; + [self expectationWithDescription:@"Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9068,13 +10956,17 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000014_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeScheduleProgrammingVisibilityWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); + uint8_t scheduleProgrammingVisibilityArgument = 1; + [cluster writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes a value of 1 to ScheduleProgrammingVisibility attribute of " + @"DUT Error: %@", + err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } @@ -9490,6 +11382,49 @@ - (void)testSendClusterTest_TC_WNCV_2_1_000010_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_WNCV_2_5_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads EndProductType attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeEndProductTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads EndProductType attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_2_5_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads EndProductType attribute constraints from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeEndProductTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads EndProductType attribute constraints from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 23); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTest_TC_WNCV_3_1_000000_DownOrClose { XCTestExpectation * expectation = [self expectationWithDescription:@"1a: TH adjusts the the DUT to a non-open position"]; @@ -12905,6 +14840,82 @@ - (void)testSendClusterTestModeSelectCluster_000007_ChangeToMode [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_DIAGSW_1_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads CurrentHeapFree non-global attribute value from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentHeapFreeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads CurrentHeapFree non-global attribute value from DUT Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DIAGSW_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads CurrentHeapUsed non-global attribute value from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentHeapUsedWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads CurrentHeapUsed non-global attribute value from DUT Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DIAGSW_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads CurrentHeapHighWaterMark non-global attribute value from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestSoftwareDiagnostics * cluster = [[CHIPTestSoftwareDiagnostics alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentHeapHighWatermarkWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads CurrentHeapHighWaterMark non-global attribute value from DUT Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTestSubscribe_OnOff_000000_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Set OnOff Attribute to false"]; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index dabc0b8bf4d653..9ddd24e1aa1078 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -166,10 +166,10 @@ class Test_TC_BI_1_1 : public TestCommand } }; -class Test_TC_CC_1_1 : public TestCommand +class Test_TC_BI_2_1 : public TestCommand { public: - Test_TC_CC_1_1() : TestCommand("Test_TC_CC_1_1"), mTestIndex(0) {} + Test_TC_BI_2_1() : TestCommand("Test_TC_BI_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -178,12 +178,12 @@ class Test_TC_CC_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_BI_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_BI_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -197,9 +197,51 @@ class Test_TC_CC_1_1 : public TestCommand switch (mTestIndex++) { case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Read mandatory non-global attribute: OutOfService\n"); + err = TestReadMandatoryNonGlobalAttributeOutOfService_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read mandatory non-global attribute constraints: OutOfService\n"); + err = TestReadMandatoryNonGlobalAttributeConstraintsOutOfService_1(); + break; + case 2: ChipLogProgress(chipTool, - " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + " ***** Test Step 2 : Write the default values to mandatory non-global attribute: OutOfService\n"); + err = TestWriteTheDefaultValuesToMandatoryNonGlobalAttributeOutOfService_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads back the mandatory non-global attribute: OutOfService\n"); + err = TestReadsBackTheMandatoryNonGlobalAttributeOutOfService_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read mandatory non-global attribute constraints: PresentValue\n"); + err = TestReadMandatoryNonGlobalAttributeConstraintsPresentValue_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : Write the default values to mandatory non-global attribute: PresentValue\n"); + err = TestWriteTheDefaultValuesToMandatoryNonGlobalAttributePresentValue_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads back the mandatory non-global attribute: PresentValue\n"); + err = TestReadsBackTheMandatoryNonGlobalAttributePresentValue_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Read mandatory non-global attribute: StatusFlags\n"); + err = TestReadMandatoryNonGlobalAttributeStatusFlags_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read mandatory non-global attribute constraints: StatusFlags\n"); + err = TestReadMandatoryNonGlobalAttributeConstraintsStatusFlags_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Write the default values to mandatory non-global attribute: StatusFlags\n"); + err = TestWriteTheDefaultValuesToMandatoryNonGlobalAttributeStatusFlags_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads back the mandatory non-global attribute: StatusFlags\n"); + err = TestReadsBackTheMandatoryNonGlobalAttributeStatusFlags_10(); break; } @@ -212,45 +254,323 @@ class Test_TC_CC_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 11; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_0(void * context, bool outOfService) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_0(outOfService); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, bool outOfService) + { + (static_cast(context))->OnSuccessResponse_1(outOfService); + } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, bool outOfService) + { + (static_cast(context))->OnSuccessResponse_2(outOfService); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, bool outOfService) + { + (static_cast(context))->OnSuccessResponse_3(outOfService); + } + + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, bool presentValue) + { + (static_cast(context))->OnSuccessResponse_4(presentValue); + } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, bool presentValue) + { + (static_cast(context))->OnSuccessResponse_5(presentValue); + } + + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, bool presentValue) + { + (static_cast(context))->OnSuccessResponse_6(presentValue); + } + + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, uint8_t statusFlags) + { + (static_cast(context))->OnSuccessResponse_7(statusFlags); + } + + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, uint8_t statusFlags) + { + (static_cast(context))->OnSuccessResponse_8(statusFlags); + } + + static void OnFailureCallback_9(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, uint8_t statusFlags) + { + (static_cast(context))->OnSuccessResponse_9(statusFlags); + } + + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context, uint8_t statusFlags) + { + (static_cast(context))->OnSuccessResponse_10(statusFlags); } // // Tests methods // - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + CHIP_ERROR TestReadMandatoryNonGlobalAttributeOutOfService_0() { - chip::Controller::ColorControlClusterTest cluster; + chip::Controller::BinaryInputBasicClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument = 4U; + return cluster.ReadAttributeOutOfService(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), - clusterRevisionArgument); + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(bool outOfService) + { + VerifyOrReturn(CheckValue("outOfService", outOfService, 0)); + NextTest(); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } + CHIP_ERROR TestReadMandatoryNonGlobalAttributeConstraintsOutOfService_1() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } + return cluster.ReadAttributeOutOfService(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(bool outOfService) + { + VerifyOrReturn(CheckConstraintType("outOfService", "", "bool")); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryNonGlobalAttributeOutOfService_2() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); + + bool outOfServiceArgument = 0; + + return cluster.WriteAttributeOutOfService(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), + outOfServiceArgument); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(bool outOfService) { NextTest(); } + + CHIP_ERROR TestReadsBackTheMandatoryNonGlobalAttributeOutOfService_3() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOutOfService(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(bool outOfService) + { + VerifyOrReturn(CheckValue("outOfService", outOfService, 0)); + NextTest(); + } + + CHIP_ERROR TestReadMandatoryNonGlobalAttributeConstraintsPresentValue_4() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributePresentValue(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + } + + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(bool presentValue) + { + VerifyOrReturn(CheckConstraintType("presentValue", "", "bool")); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryNonGlobalAttributePresentValue_5() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); + + bool presentValueArgument = 0; + + return cluster.WriteAttributePresentValue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel(), + presentValueArgument); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(bool presentValue) { NextTest(); } + + CHIP_ERROR TestReadsBackTheMandatoryNonGlobalAttributePresentValue_6() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributePresentValue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(bool presentValue) + { + VerifyOrReturn(CheckValue("presentValue", presentValue, 0)); + NextTest(); + } + + CHIP_ERROR TestReadMandatoryNonGlobalAttributeStatusFlags_7() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeStatusFlags(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(uint8_t statusFlags) + { + VerifyOrReturn(CheckValue("statusFlags", statusFlags, 0)); + NextTest(); + } + + CHIP_ERROR TestReadMandatoryNonGlobalAttributeConstraintsStatusFlags_8() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeStatusFlags(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(uint8_t statusFlags) + { + VerifyOrReturn(CheckConstraintType("statusFlags", "", "map8")); + VerifyOrReturn(CheckConstraintMaxValue("statusFlags", statusFlags, 15)); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryNonGlobalAttributeStatusFlags_9() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint8_t statusFlagsArgument = 0; + + return cluster.WriteAttributeStatusFlags(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel(), statusFlagsArgument); + } + + void OnFailureResponse_9(uint8_t status) { NextTest(); } + + void OnSuccessResponse_9(uint8_t statusFlags) { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackTheMandatoryNonGlobalAttributeStatusFlags_10() + { + chip::Controller::BinaryInputBasicClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeStatusFlags(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(uint8_t statusFlags) + { + VerifyOrReturn(CheckValue("statusFlags", statusFlags, 0)); + NextTest(); + } }; -class Test_TC_CC_2_1 : public TestCommand +class Test_TC_CC_1_1 : public TestCommand { public: - Test_TC_CC_2_1() : TestCommand("Test_TC_CC_2_1"), mTestIndex(0) {} + Test_TC_CC_1_1() : TestCommand("Test_TC_CC_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -259,12 +579,12 @@ class Test_TC_CC_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -278,14 +598,95 @@ class Test_TC_CC_2_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reads mandatory attribute: CurrentHue\n"); - err = TestReadsMandatoryAttributeCurrentHue_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Validate constraints of attribute: current hue\n"); - err = TestValidateConstraintsOfAttributeCurrentHue_1(); + ChipLogProgress(chipTool, + " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); break; - case 2: + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } + + // + // Tests methods + // + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument = 4U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), + clusterRevisionArgument); + } + + void OnFailureResponse_0(uint8_t status) { NextTest(); } + + void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } +}; + +class Test_TC_CC_2_1 : public TestCommand +{ +public: + Test_TC_CC_2_1() : TestCommand("Test_TC_CC_2_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_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 : Reads mandatory attribute: CurrentHue\n"); + err = TestReadsMandatoryAttributeCurrentHue_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Validate constraints of attribute: current hue\n"); + err = TestValidateConstraintsOfAttributeCurrentHue_1(); + break; + case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Write the default value to mandatory attribute: CurrentHue\n"); err = TestWriteTheDefaultValueToMandatoryAttributeCurrentHue_2(); break; @@ -9584,10 +9985,10 @@ class Test_TC_CC_8_1 : public TestCommand } }; -class Test_TC_DM_1_1 : public TestCommand +class Test_TC_CC_9_2 : public TestCommand { public: - Test_TC_DM_1_1() : TestCommand("Test_TC_DM_1_1"), mTestIndex(0) {} + Test_TC_CC_9_2() : TestCommand("Test_TC_CC_9_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -9596,12 +9997,12 @@ class Test_TC_DM_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -9615,76 +10016,60 @@ class Test_TC_DM_1_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Query Interaction Model Version\n"); - err = TestQueryInteractionModelVersion_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition: Turn on light for color control tests\n"); + err = TestPreconditionTurnOnLightForColorControlTests_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Query Vendor Name\n"); - err = TestQueryVendorName_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Check on/off attribute value is true after on command\n"); + err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Query VendorID\n"); - err = TestQueryVendorID_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Query Product Name\n"); - err = TestQueryProductName_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Query ProductID\n"); - err = TestQueryProductID_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopDirection attribute from DUT.\n"); + err = TestReadColorLoopDirectionAttributeFromDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Query User Label\n"); - err = TestQueryUserLabel_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopTime attribute from DUT.\n"); + err = TestReadColorLoopTimeAttributeFromDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Query User Location\n"); - err = TestQueryUserLocation_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); + err = TestReadColorLoopStartEnhancedHueAttributeFromDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Query HardwareVersion\n"); - err = TestQueryHardwareVersion_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Color Loop Set Command - Set all Attributes\n"); + err = TestColorLoopSetCommandSetAllAttributes_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Query HardwareVersionString\n"); - err = TestQueryHardwareVersionString_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopActive attribute from DUT.\n"); + err = TestReadColorLoopActiveAttributeFromDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Query SoftwareVersion\n"); - err = TestQuerySoftwareVersion_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Start Color Loop\n"); + err = TestColorLoopSetCommandStartColorLoop_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Query SoftwareVersionString\n"); - err = TestQuerySoftwareVersionString_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopDirection attribute from DUT.\n"); + err = TestReadColorLoopDirectionAttributeFromDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Query ManufacturingDate\n"); - err = TestQueryManufacturingDate_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Color Loop Set Command - Start Color Loop\n"); + err = TestColorLoopSetCommandStartColorLoop_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Query PartNumber\n"); - err = TestQueryPartNumber_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Query ProductURL\n"); - err = TestQueryProductURL_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Query ProductLabel\n"); - err = TestQueryProductLabel_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Query SerialNumber\n"); - err = TestQuerySerialNumber_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Query LocalConfigDisabled\n"); - err = TestQueryLocalConfigDisabled_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Query Reachable\n"); - err = TestQueryReachable_17(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Turn off light for color control tests\n"); + err = TestTurnOffLightForColorControlTests_13(); break; } @@ -9697,622 +10082,418 @@ class Test_TC_DM_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 14; - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, - this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, - this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, + this }; chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ - OnSuccessCallback_8, this + chip::Callback::Callback mOnSuccessCallback_6{ + OnSuccessCallback_6, this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ - OnSuccessCallback_10, this - }; - chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; - chip::Callback::Callback mOnSuccessCallback_11{ - OnSuccessCallback_11, this - }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, + this }; chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; - chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, - this }; - chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; - chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, - this }; - chip::Callback::Callback mOnFailureCallback_14{ OnFailureCallback_14, this }; - chip::Callback::Callback mOnSuccessCallback_14{ OnSuccessCallback_14, - this }; - chip::Callback::Callback mOnFailureCallback_15{ OnFailureCallback_15, this }; - chip::Callback::Callback mOnSuccessCallback_15{ OnSuccessCallback_15, - this }; - chip::Callback::Callback mOnFailureCallback_16{ OnFailureCallback_16, this }; - chip::Callback::Callback mOnSuccessCallback_16{ OnSuccessCallback_16, - this }; - chip::Callback::Callback mOnFailureCallback_17{ OnFailureCallback_17, this }; - chip::Callback::Callback mOnSuccessCallback_17{ OnSuccessCallback_17, this }; - - static void OnFailureCallback_0(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_0(status); - } - - static void OnSuccessCallback_0(void * context, uint16_t interactionModelVersion) - { - (static_cast(context))->OnSuccessResponse_0(interactionModelVersion); - } + chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, this }; static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); - } - - static void OnSuccessCallback_1(void * context, chip::CharSpan vendorName) - { - (static_cast(context))->OnSuccessResponse_1(vendorName); - } - - static void OnFailureCallback_2(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_2(void * context, uint16_t vendorID) + static void OnSuccessCallback_1(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_2(vendorID); + (static_cast(context))->OnSuccessResponse_1(onOff); } static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_3(void * context, chip::CharSpan productName) + static void OnSuccessCallback_3(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_3(productName); + (static_cast(context))->OnSuccessResponse_3(colorLoopActive); } static void OnFailureCallback_4(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_4(void * context, uint16_t productID) + static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_4(productID); + (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); } static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_5(status); } - static void OnSuccessCallback_5(void * context, chip::CharSpan userLabel) + static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) { - (static_cast(context))->OnSuccessResponse_5(userLabel); + (static_cast(context))->OnSuccessResponse_5(colorLoopTime); } static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(status); - } - - static void OnSuccessCallback_6(void * context, chip::CharSpan location) - { - (static_cast(context))->OnSuccessResponse_6(location); - } - - static void OnFailureCallback_7(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_6(status); } - static void OnSuccessCallback_7(void * context, uint16_t hardwareVersion) + static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) { - (static_cast(context))->OnSuccessResponse_7(hardwareVersion); + (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); } static void OnFailureCallback_8(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_8(status); } - static void OnSuccessCallback_8(void * context, chip::CharSpan hardwareVersionString) + static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_8(hardwareVersionString); + (static_cast(context))->OnSuccessResponse_8(colorLoopActive); } - static void OnFailureCallback_9(void * context, uint8_t status) + static void OnFailureCallback_10(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_9(void * context, uint32_t softwareVersion) + static void OnSuccessCallback_10(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_9(softwareVersion); + (static_cast(context))->OnSuccessResponse_10(colorLoopDirection); } - static void OnFailureCallback_10(void * context, uint8_t status) + static void OnFailureCallback_12(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_12(status); } - static void OnSuccessCallback_10(void * context, chip::CharSpan softwareVersionString) + static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_10(softwareVersionString); + (static_cast(context))->OnSuccessResponse_12(colorLoopActive); } - static void OnFailureCallback_11(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_11(status); - } + // + // Tests methods + // - static void OnSuccessCallback_11(void * context, chip::CharSpan manufacturingDate) + CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_0() { - (static_cast(context))->OnSuccessResponse_11(manufacturingDate); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_12(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_12(status); - } - - static void OnSuccessCallback_12(void * context, chip::CharSpan partNumber) - { - (static_cast(context))->OnSuccessResponse_12(partNumber); - } - - static void OnFailureCallback_13(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_13(status); - } - - static void OnSuccessCallback_13(void * context, chip::CharSpan productURL) - { - (static_cast(context))->OnSuccessResponse_13(productURL); - } - - static void OnFailureCallback_14(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_14(status); - } - - static void OnSuccessCallback_14(void * context, chip::CharSpan productLabel) - { - (static_cast(context))->OnSuccessResponse_14(productLabel); - } - - static void OnFailureCallback_15(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_15(status); - } - - static void OnSuccessCallback_15(void * context, chip::CharSpan serialNumber) - { - (static_cast(context))->OnSuccessResponse_15(serialNumber); - } + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; - static void OnFailureCallback_16(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_16(status); - } + chip::app::Clusters::OnOff::Commands::On::Type request; - static void OnSuccessCallback_16(void * context, bool localConfigDisabled) - { - (static_cast(context))->OnSuccessResponse_16(localConfigDisabled); - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; - static void OnFailureCallback_17(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_17(status); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnSuccessCallback_17(void * context, bool reachable) - { - (static_cast(context))->OnSuccessResponse_17(reachable); - } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_0() { NextTest(); } - CHIP_ERROR TestQueryInteractionModelVersion_0() + CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeInteractionModelVersion(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint16_t interactionModelVersion) + void OnSuccessResponse_1(bool onOff) { - VerifyOrReturn(CheckConstraintType("interactionModelVersion", "", "uint16")); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestQueryVendorName_1() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_2() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeVendorName(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnSuccessResponse_1(chip::CharSpan vendorName) - { - VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); - NextTest(); - } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(15); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 30U; + request.startHue = 160U; + request.optionsMask = 0; + request.optionsOverride = 0; - CHIP_ERROR TestQueryVendorID_2() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; - return cluster.ReadAttributeVendorID(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint16_t vendorID) - { - VerifyOrReturn(CheckConstraintType("vendorID", "", "uint16")); - NextTest(); - } + void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestQueryProductName_3() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_3() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeProductName(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(chip::CharSpan productName) + void OnSuccessResponse_3(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("productName", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("productName", productName.size(), 32)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestQueryProductID_4() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_4() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeProductID(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); } void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint16_t productID) + void OnSuccessResponse_4(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); NextTest(); } - CHIP_ERROR TestQueryUserLabel_5() + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_5() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeUserLabel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(chip::CharSpan userLabel) + void OnSuccessResponse_5(uint16_t colorLoopTime) { - VerifyOrReturn(CheckConstraintType("userLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("userLabel", userLabel.size(), 32)); + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); NextTest(); } - CHIP_ERROR TestQueryUserLocation_6() + CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_6() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeLocation(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); } void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(chip::CharSpan location) + void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) { - VerifyOrReturn(CheckConstraintType("location", "", "string")); - VerifyOrReturn(CheckConstraintFormat("location", "", "ISO 3166-1 alpha-2")); - VerifyOrReturn(CheckConstraintMaxLength("location", location.size(), 2)); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); NextTest(); } - CHIP_ERROR TestQueryHardwareVersion_7() + CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_7() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeHardwareVersion(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(1); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(uint16_t hardwareVersion) - { - VerifyOrReturn(CheckConstraintType("hardwareVersion", "", "uint16")); - NextTest(); - } + void OnSuccessResponse_7() { NextTest(); } - CHIP_ERROR TestQueryHardwareVersionString_8() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_8() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeHardwareVersionString(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); } void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(chip::CharSpan hardwareVersionString) + void OnSuccessResponse_8(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("hardwareVersionString", "", "string")); - VerifyOrReturn(CheckConstraintMinLength("hardwareVersionString", hardwareVersionString.size(), 1)); - VerifyOrReturn(CheckConstraintMaxLength("hardwareVersionString", hardwareVersionString.size(), 64)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestQuerySoftwareVersion_9() + CHIP_ERROR TestColorLoopSetCommandStartColorLoop_9() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSoftwareVersion(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(2); + request.action = static_cast(0); + request.direction = static_cast(1); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_9(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_9(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(uint32_t softwareVersion) - { - VerifyOrReturn(CheckConstraintType("softwareVersion", "", "uint32")); - NextTest(); - } + void OnSuccessResponse_9() { NextTest(); } - CHIP_ERROR TestQuerySoftwareVersionString_10() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_10() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSoftwareVersionString(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); } void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(chip::CharSpan softwareVersionString) + void OnSuccessResponse_10(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckConstraintType("softwareVersionString", "", "string")); - VerifyOrReturn(CheckConstraintFormat("softwareVersionString", "", "ASCII")); - VerifyOrReturn(CheckConstraintMinLength("softwareVersionString", softwareVersionString.size(), 1)); - VerifyOrReturn(CheckConstraintMaxLength("softwareVersionString", softwareVersionString.size(), 64)); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); NextTest(); } - CHIP_ERROR TestQueryManufacturingDate_11() + CHIP_ERROR TestColorLoopSetCommandStartColorLoop_11() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeManufacturingDate(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnFailureResponse_11(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnSuccessResponse_11(chip::CharSpan manufacturingDate) - { - VerifyOrReturn(CheckConstraintType("manufacturingDate", "", "string")); - VerifyOrReturn(CheckConstraintFormat("manufacturingDate", "", "ISO 8601")); - VerifyOrReturn(CheckConstraintMinLength("manufacturingDate", manufacturingDate.size(), 8)); - VerifyOrReturn(CheckConstraintMaxLength("manufacturingDate", manufacturingDate.size(), 16)); - NextTest(); - } - - CHIP_ERROR TestQueryPartNumber_12() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributePartNumber(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); - } - - void OnFailureResponse_12(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_12(chip::CharSpan partNumber) - { - VerifyOrReturn(CheckConstraintType("partNumber", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("partNumber", partNumber.size(), 32)); - NextTest(); - } - - CHIP_ERROR TestQueryProductURL_13() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeProductURL(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); - } - - void OnFailureResponse_13(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_13(chip::CharSpan productURL) - { - VerifyOrReturn(CheckConstraintType("productURL", "", "string")); - VerifyOrReturn(CheckConstraintFormat("productURL", "", "RFC3986")); - VerifyOrReturn(CheckConstraintMaxLength("productURL", productURL.size(), 256)); - NextTest(); - } - - CHIP_ERROR TestQueryProductLabel_14() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeProductLabel(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel()); - } - - void OnFailureResponse_14(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_14(chip::CharSpan productLabel) - { - VerifyOrReturn(CheckConstraintType("productLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("productLabel", productLabel.size(), 64)); - NextTest(); - } - - CHIP_ERROR TestQuerySerialNumber_15() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeSerialNumber(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); - } - - void OnFailureResponse_15(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_15(chip::CharSpan serialNumber) - { - VerifyOrReturn(CheckConstraintType("serialNumber", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("serialNumber", serialNumber.size(), 32)); - NextTest(); - } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - CHIP_ERROR TestQueryLocalConfigDisabled_16() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; - return cluster.ReadAttributeLocalConfigDisabled(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel()); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_16(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_16(bool localConfigDisabled) - { - VerifyOrReturn(CheckConstraintType("localConfigDisabled", "", "boolean")); - NextTest(); - } + void OnSuccessResponse_11() { NextTest(); } - CHIP_ERROR TestQueryReachable_17() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeReachable(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); } - void OnFailureResponse_17(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_17(bool reachable) + void OnSuccessResponse_12(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("reachable", "", "boolean")); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } -}; - -class Test_TC_DM_3_1 : public TestCommand -{ -public: - Test_TC_DM_3_1() : TestCommand("Test_TC_DM_3_1"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestTurnOffLightForColorControlTests_13() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_1\n"); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - Wait(); + chip::app::Clusters::OnOff::Commands::Off::Type request; - // 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++) - { - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_13() { NextTest(); } }; -class Test_TC_EMR_1_1 : public TestCommand +class Test_TC_CC_9_3 : public TestCommand { public: - Test_TC_EMR_1_1() : TestCommand("Test_TC_EMR_1_1"), mTestIndex(0) {} + Test_TC_CC_9_3() : TestCommand("Test_TC_CC_9_3"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -10321,12 +10502,12 @@ class Test_TC_EMR_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_EMR_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EMR_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -10340,17 +10521,60 @@ class Test_TC_EMR_1_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition: Turn on light for color control tests\n"); + err = TestPreconditionTurnOnLightForColorControlTests_0(); break; case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: Check on/off attribute value is true after on command\n"); + err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopDirection attribute from DUT.\n"); + err = TestReadColorLoopDirectionAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopTime attribute from DUT.\n"); + err = TestReadColorLoopTimeAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); + err = TestReadColorLoopStartEnhancedHueAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Color Loop Set Command - Set all Attributes\n"); + err = TestColorLoopSetCommandSetAllAttributes_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopActive attribute from DUT.\n"); + err = TestReadColorLoopActiveAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Start Color Loop\n"); + err = TestColorLoopSetCommandStartColorLoop_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopTime attribute from DUT.\n"); + err = TestReadColorLoopTimeAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Color Loop Set Command - Start Color Loop\n"); + err = TestColorLoopSetCommandStartColorLoop_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Turn off light for color control tests\n"); + err = TestTurnOffLightForColorControlTests_13(); break; } @@ -10363,485 +10587,417 @@ class Test_TC_EMR_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 14; - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, + this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ + OnSuccessCallback_6, this + }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; + chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, this }; - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_1(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_1(onOff); } - static void OnFailureCallback_1(void * context, uint8_t status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_3(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); + (static_cast(context))->OnSuccessResponse_3(colorLoopActive); } - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_4(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); } - // - // Tests methods - // + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) { - chip::Controller::ElectricalMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + (static_cast(context))->OnSuccessResponse_5(colorLoopTime); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint16_t clusterRevision) + static void OnFailureCallback_6(void * context, uint8_t status) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); - NextTest(); + (static_cast(context))->OnFailureResponse_6(status); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) { - chip::Controller::ElectricalMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - uint16_t clusterRevisionArgument = 1U; - - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), - clusterRevisionArgument); + (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } - - void OnSuccessResponse_1(uint16_t clusterRevision) { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + static void OnFailureCallback_8(void * context, uint8_t status) { - chip::Controller::ElectricalMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + (static_cast(context))->OnFailureResponse_8(status); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_2(uint16_t clusterRevision) + static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); - NextTest(); + (static_cast(context))->OnSuccessResponse_8(colorLoopActive); } -}; - -class Test_TC_FLW_1_1 : public TestCommand -{ -public: - Test_TC_FLW_1_1() : TestCommand("Test_TC_FLW_1_1"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnFailureCallback_10(void * context, uint8_t status) { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_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 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + (static_cast(context))->OnFailureResponse_10(status); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + static void OnSuccessCallback_10(void * context, uint16_t colorLoopTime) + { + (static_cast(context))->OnSuccessResponse_10(colorLoopTime); + } - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_12(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_12(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_12(colorLoopActive); } // // Tests methods // - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_0() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument = 2U; + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), - clusterRevisionArgument); + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } -}; + void OnSuccessResponse_0() { NextTest(); } -class Test_TC_FLW_2_1 : public TestCommand -{ -public: - Test_TC_FLW_2_1() : TestCommand("Test_TC_FLW_2_1"), mTestIndex(0) {} + CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - /////////// TestCommand Interface ///////// - void NextTest() override + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(bool onOff) { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_1\n"); - } + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_2() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - Wait(); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(15); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 30U; + request.startHue = 160U; + request.optionsMask = 0; + request.optionsOverride = 0; - // 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 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : write the default value to optional attribute: MinMeasuredValue\n"); - err = TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : write the default value to optional attribute: MaxMeasuredValue\n"); - err = TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_7(); - break; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + void OnSuccessResponse_2() { NextTest(); } - static void OnFailureCallback_0(void * context, uint8_t status) + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_3() { - (static_cast(context))->OnFailureResponse_0(status); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_0(void * context, int16_t measuredValue) - { - (static_cast(context))->OnSuccessResponse_0(measuredValue); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } - static void OnFailureCallback_1(void * context, uint8_t status) + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t colorLoopActive) { - (static_cast(context))->OnFailureResponse_1(status); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); + NextTest(); } - static void OnSuccessCallback_1(void * context, int16_t minMeasuredValue) + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_4() { - (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); } - static void OnFailureCallback_2(void * context, uint8_t status) + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(uint8_t colorLoopDirection) { - (static_cast(context))->OnFailureResponse_2(status); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); + NextTest(); } - static void OnSuccessCallback_2(void * context, int16_t maxMeasuredValue) + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_5() { - (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } - static void OnFailureCallback_3(void * context, uint8_t status) + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint16_t colorLoopTime) { - (static_cast(context))->OnFailureResponse_3(status); + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); + NextTest(); } - static void OnSuccessCallback_3(void * context, int16_t minMeasuredValue) + CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_6() { - (static_cast(context))->OnSuccessResponse_3(minMeasuredValue); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_4(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_4(status); + return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); } - static void OnSuccessCallback_4(void * context, int16_t maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_4(maxMeasuredValue); - } + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_5(void * context, uint8_t status) + void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) { - (static_cast(context))->OnFailureResponse_5(status); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); + NextTest(); } - static void OnSuccessCallback_5(void * context, int16_t measuredValue) + CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_7() { - (static_cast(context))->OnSuccessResponse_5(measuredValue); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_6(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_6(status); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - static void OnSuccessCallback_6(void * context, int16_t minMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_6(minMeasuredValue); - } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(1); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - static void OnFailureCallback_7(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_7(status); - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; - static void OnSuccessCallback_7(void * context, int16_t maxMeasuredValue) - { - (static_cast(context))->OnSuccessResponse_7(maxMeasuredValue); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - // - // Tests methods - // + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() + void OnSuccessResponse_7() { NextTest(); } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_8() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(int16_t measuredValue) + void OnSuccessResponse_8(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() + CHIP_ERROR TestColorLoopSetCommandStartColorLoop_9() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(4); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 60U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - void OnSuccessResponse_1(int16_t minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); - NextTest(); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_9(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_9(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_10() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(int16_t maxMeasuredValue) + void OnSuccessResponse_10(uint16_t colorLoopTime) { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 60U)); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3() + CHIP_ERROR TestColorLoopSetCommandStartColorLoop_11() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - int16_t minMeasuredValueArgument = 0; - - return cluster.WriteAttributeMinMeasuredValue(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel(), - minMeasuredValueArgument); - } - - void OnFailureResponse_3(uint8_t status) { NextTest(); } - - void OnSuccessResponse_3(int16_t minMeasuredValue) { ThrowSuccessResponse(); } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - int16_t maxMeasuredValueArgument = 0; + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; - return cluster.WriteAttributeMaxMeasuredValue(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), - maxMeasuredValueArgument); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_4(uint8_t status) { NextTest(); } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(int16_t maxMeasuredValue) { ThrowSuccessResponse(); } + void OnSuccessResponse_11() { NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_5() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(int16_t measuredValue) + void OnSuccessResponse_12(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_6() + CHIP_ERROR TestTurnOffLightForColorControlTests_13() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); - } - - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnSuccessResponse_6(int16_t minMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); - NextTest(); - } + chip::app::Clusters::OnOff::Commands::Off::Type request; - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_7() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; - return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(int16_t maxMeasuredValue) - { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); - NextTest(); - } + void OnSuccessResponse_13() { NextTest(); } }; -class Test_TC_FLW_2_2 : public TestCommand +class Test_TC_DM_1_1 : public TestCommand { public: - Test_TC_FLW_2_2() : TestCommand("Test_TC_FLW_2_2"), mTestIndex(0) {} + Test_TC_DM_1_1() : TestCommand("Test_TC_DM_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -10850,12 +11006,12 @@ class Test_TC_FLW_2_2 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -10869,250 +11025,76 @@ class Test_TC_FLW_2_2 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Query Interaction Model Version\n"); + err = TestQueryInteractionModelVersion_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_1(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; - - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - - static void OnFailureCallback_0(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_0(status); - } - - static void OnSuccessCallback_0(void * context, int16_t measuredValue) - { - (static_cast(context))->OnSuccessResponse_0(measuredValue); - } - - static void OnFailureCallback_1(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_1(status); - } - - static void OnSuccessCallback_1(void * context, int16_t measuredValue) - { - (static_cast(context))->OnSuccessResponse_1(measuredValue); - } - - // - // Tests methods - // - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); - } - - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(int16_t measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() - { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); - } - - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1(int16_t measuredValue) - { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - } -}; - -class Test_TC_LVL_1_1 : public TestCommand -{ -public: - Test_TC_LVL_1_1() : TestCommand("Test_TC_LVL_1_1"), mTestIndex(0) {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_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 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); - break; - } - - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - - static void OnFailureCallback_0(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_0(status); - } - - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); - } - - // - // Tests methods - // - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - uint16_t clusterRevisionArgument = 4U; - - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), - clusterRevisionArgument); - } - - void OnFailureResponse_0(uint8_t status) { NextTest(); } - - void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } -}; - -class Test_TC_LVL_2_1 : public TestCommand -{ -public: - Test_TC_LVL_2_1() : TestCommand("Test_TC_LVL_2_1"), mTestIndex(0) {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_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 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Query Vendor Name\n"); + err = TestQueryVendorName_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 100ms\n"); - err = TestWait100ms_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Query VendorID\n"); + err = TestQueryVendorID_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Query Product Name\n"); + err = TestQueryProductName_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Query ProductID\n"); + err = TestQueryProductID_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 200ms\n"); - err = TestWait200ms_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Query User Label\n"); + err = TestQueryUserLabel_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Query User Location\n"); + err = TestQueryUserLocation_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : reads On Off Transition Time attribute from DUT\n"); - err = TestReadsOnOffTransitionTimeAttributeFromDut_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Query HardwareVersion\n"); + err = TestQueryHardwareVersion_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Query HardwareVersionString\n"); + err = TestQueryHardwareVersionString_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 10ms\n"); - err = TestWait10ms_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Query SoftwareVersion\n"); + err = TestQuerySoftwareVersion_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Query SoftwareVersionString\n"); + err = TestQuerySoftwareVersionString_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Reset level to 0\n"); - err = TestResetLevelTo0_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Query ManufacturingDate\n"); + err = TestQueryManufacturingDate_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); - err = TestWait100ms_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Query PartNumber\n"); + err = TestQueryPartNumber_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Query ProductURL\n"); + err = TestQueryProductURL_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Query ProductLabel\n"); + err = TestQueryProductLabel_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Query SerialNumber\n"); + err = TestQuerySerialNumber_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Query LocalConfigDisabled\n"); + err = TestQueryLocalConfigDisabled_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Query Reachable\n"); + err = TestQueryReachable_17(); break; } @@ -11125,279 +11107,3339 @@ class Test_TC_LVL_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 13; + const uint16_t mTestCount = 18; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, + this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, + this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, - this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ + OnSuccessCallback_8, this + }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ + OnSuccessCallback_10, this + }; + chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_11{ + OnSuccessCallback_11, this + }; + chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; + chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, + this }; + chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, + this }; + chip::Callback::Callback mOnFailureCallback_14{ OnFailureCallback_14, this }; + chip::Callback::Callback mOnSuccessCallback_14{ OnSuccessCallback_14, + this }; + chip::Callback::Callback mOnFailureCallback_15{ OnFailureCallback_15, this }; + chip::Callback::Callback mOnSuccessCallback_15{ OnSuccessCallback_15, + this }; + chip::Callback::Callback mOnFailureCallback_16{ OnFailureCallback_16, this }; + chip::Callback::Callback mOnSuccessCallback_16{ OnSuccessCallback_16, + this }; + chip::Callback::Callback mOnFailureCallback_17{ OnFailureCallback_17, this }; + chip::Callback::Callback mOnSuccessCallback_17{ OnSuccessCallback_17, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context, uint8_t currentLevel) + static void OnSuccessCallback_0(void * context, uint16_t interactionModelVersion) { - (static_cast(context))->OnSuccessResponse_0(currentLevel); + (static_cast(context))->OnSuccessResponse_0(interactionModelVersion); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_3(void * context, uint8_t currentLevel) + static void OnSuccessCallback_1(void * context, chip::CharSpan vendorName) { - (static_cast(context))->OnSuccessResponse_3(currentLevel); + (static_cast(context))->OnSuccessResponse_1(vendorName); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_6(void * context, uint8_t currentLevel) + static void OnSuccessCallback_2(void * context, uint16_t vendorID) { - (static_cast(context))->OnSuccessResponse_6(currentLevel); + (static_cast(context))->OnSuccessResponse_2(vendorID); } - static void OnFailureCallback_7(void * context, uint8_t status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_7(void * context, uint16_t onOffTransitionTime) + static void OnSuccessCallback_3(void * context, chip::CharSpan productName) { - (static_cast(context))->OnSuccessResponse_7(onOffTransitionTime); + (static_cast(context))->OnSuccessResponse_3(productName); } - static void OnFailureCallback_10(void * context, uint8_t status) + static void OnFailureCallback_4(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_10(void * context, uint8_t currentLevel) + static void OnSuccessCallback_4(void * context, uint16_t productID) { - (static_cast(context))->OnSuccessResponse_10(currentLevel); + (static_cast(context))->OnSuccessResponse_4(productID); } - // - // Tests methods - // - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() + static void OnFailureCallback_5(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + (static_cast(context))->OnFailureResponse_5(status); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint8_t currentLevel) + static void OnSuccessCallback_5(void * context, chip::CharSpan userLabel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); - NextTest(); + (static_cast(context))->OnSuccessResponse_5(userLabel); } - CHIP_ERROR TestSendsAMoveToLevelCommand_1() + static void OnFailureCallback_6(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 64; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + (static_cast(context))->OnFailureResponse_6(status); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestWait100ms_2() { return WaitForMs(100); } + static void OnSuccessCallback_6(void * context, chip::CharSpan location) + { + (static_cast(context))->OnSuccessResponse_6(location); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() + static void OnFailureCallback_7(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_7(status); + } - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + static void OnSuccessCallback_7(void * context, uint16_t hardwareVersion) + { + (static_cast(context))->OnSuccessResponse_7(hardwareVersion); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } - void OnSuccessResponse_3(uint8_t currentLevel) + static void OnSuccessCallback_8(void * context, chip::CharSpan hardwareVersionString) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); - NextTest(); + (static_cast(context))->OnSuccessResponse_8(hardwareVersionString); } - CHIP_ERROR TestSendsAMoveToLevelCommand_4() + static void OnFailureCallback_9(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_9(status); + } - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; + static void OnSuccessCallback_9(void * context, uint32_t softwareVersion) + { + (static_cast(context))->OnSuccessResponse_9(softwareVersion); + } - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 128; - request.transitionTime = 1U; - request.optionMask = 1; - request.optionOverride = 1; + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(status); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; + static void OnSuccessCallback_10(void * context, chip::CharSpan softwareVersionString) + { + (static_cast(context))->OnSuccessResponse_10(softwareVersionString); + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + static void OnFailureCallback_11(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_11(status); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_11(void * context, chip::CharSpan manufacturingDate) + { + (static_cast(context))->OnSuccessResponse_11(manufacturingDate); + } - void OnSuccessResponse_4() { NextTest(); } + static void OnFailureCallback_12(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_12(status); + } - CHIP_ERROR TestWait200ms_5() { return WaitForMs(200); } + static void OnSuccessCallback_12(void * context, chip::CharSpan partNumber) + { + (static_cast(context))->OnSuccessResponse_12(partNumber); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() + static void OnFailureCallback_13(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_13(status); + } - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + static void OnSuccessCallback_13(void * context, chip::CharSpan productURL) + { + (static_cast(context))->OnSuccessResponse_13(productURL); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_14(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_14(status); + } - void OnSuccessResponse_6(uint8_t currentLevel) + static void OnSuccessCallback_14(void * context, chip::CharSpan productLabel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); - NextTest(); + (static_cast(context))->OnSuccessResponse_14(productLabel); } - CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_7() + static void OnFailureCallback_15(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_15(status); + } - return cluster.ReadAttributeOnOffTransitionTime(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + static void OnSuccessCallback_15(void * context, chip::CharSpan serialNumber) + { + (static_cast(context))->OnSuccessResponse_15(serialNumber); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_16(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_16(status); + } - void OnSuccessResponse_7(uint16_t onOffTransitionTime) + static void OnSuccessCallback_16(void * context, bool localConfigDisabled) { - VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); - NextTest(); + (static_cast(context))->OnSuccessResponse_16(localConfigDisabled); } - CHIP_ERROR TestSendsAMoveToLevelCommand_8() + static void OnFailureCallback_17(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_17(status); + } - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; + static void OnSuccessCallback_17(void * context, bool reachable) + { + (static_cast(context))->OnSuccessResponse_17(reachable); + } - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 254; - request.transitionTime = 65535U; - request.optionMask = 1; - request.optionOverride = 1; + // + // Tests methods + // - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; + CHIP_ERROR TestQueryInteractionModelVersion_0() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_8(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttributeInteractionModelVersion(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_8() { NextTest(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestWait10ms_9() { return WaitForMs(10); } + void OnSuccessResponse_0(uint16_t interactionModelVersion) + { + VerifyOrReturn(CheckConstraintType("interactionModelVersion", "", "uint16")); + NextTest(); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + CHIP_ERROR TestQueryVendorName_1() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeVendorName(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint8_t currentLevel) + void OnSuccessResponse_1(chip::CharSpan vendorName) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); NextTest(); } - CHIP_ERROR TestResetLevelTo0_11() + CHIP_ERROR TestQueryVendorID_2() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeVendorID(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint16_t vendorID) + { + VerifyOrReturn(CheckConstraintType("vendorID", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestQueryProductName_3() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeProductName(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(chip::CharSpan productName) + { + VerifyOrReturn(CheckConstraintType("productName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("productName", productName.size(), 32)); + NextTest(); + } + + CHIP_ERROR TestQueryProductID_4() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeProductID(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + } + + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(uint16_t productID) + { + VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestQueryUserLabel_5() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeUserLabel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(chip::CharSpan userLabel) + { + VerifyOrReturn(CheckConstraintType("userLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("userLabel", userLabel.size(), 32)); + NextTest(); + } + + CHIP_ERROR TestQueryUserLocation_6() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeLocation(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(chip::CharSpan location) + { + VerifyOrReturn(CheckConstraintType("location", "", "string")); + VerifyOrReturn(CheckConstraintFormat("location", "", "ISO 3166-1 alpha-2")); + VerifyOrReturn(CheckConstraintMaxLength("location", location.size(), 2)); + NextTest(); + } + + CHIP_ERROR TestQueryHardwareVersion_7() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeHardwareVersion(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(uint16_t hardwareVersion) + { + VerifyOrReturn(CheckConstraintType("hardwareVersion", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestQueryHardwareVersionString_8() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeHardwareVersionString(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(chip::CharSpan hardwareVersionString) + { + VerifyOrReturn(CheckConstraintType("hardwareVersionString", "", "string")); + VerifyOrReturn(CheckConstraintMinLength("hardwareVersionString", hardwareVersionString.size(), 1)); + VerifyOrReturn(CheckConstraintMaxLength("hardwareVersionString", hardwareVersionString.size(), 64)); + NextTest(); + } + + CHIP_ERROR TestQuerySoftwareVersion_9() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeSoftwareVersion(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + } + + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9(uint32_t softwareVersion) + { + VerifyOrReturn(CheckConstraintType("softwareVersion", "", "uint32")); + NextTest(); + } + + CHIP_ERROR TestQuerySoftwareVersionString_10() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeSoftwareVersionString(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(chip::CharSpan softwareVersionString) + { + VerifyOrReturn(CheckConstraintType("softwareVersionString", "", "string")); + VerifyOrReturn(CheckConstraintFormat("softwareVersionString", "", "ASCII")); + VerifyOrReturn(CheckConstraintMinLength("softwareVersionString", softwareVersionString.size(), 1)); + VerifyOrReturn(CheckConstraintMaxLength("softwareVersionString", softwareVersionString.size(), 64)); + NextTest(); + } + + CHIP_ERROR TestQueryManufacturingDate_11() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeManufacturingDate(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + } + + void OnFailureResponse_11(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_11(chip::CharSpan manufacturingDate) + { + VerifyOrReturn(CheckConstraintType("manufacturingDate", "", "string")); + VerifyOrReturn(CheckConstraintFormat("manufacturingDate", "", "ISO 8601")); + VerifyOrReturn(CheckConstraintMinLength("manufacturingDate", manufacturingDate.size(), 8)); + VerifyOrReturn(CheckConstraintMaxLength("manufacturingDate", manufacturingDate.size(), 16)); + NextTest(); + } + + CHIP_ERROR TestQueryPartNumber_12() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributePartNumber(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + } + + void OnFailureResponse_12(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_12(chip::CharSpan partNumber) + { + VerifyOrReturn(CheckConstraintType("partNumber", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("partNumber", partNumber.size(), 32)); + NextTest(); + } + + CHIP_ERROR TestQueryProductURL_13() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeProductURL(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + } + + void OnFailureResponse_13(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_13(chip::CharSpan productURL) + { + VerifyOrReturn(CheckConstraintType("productURL", "", "string")); + VerifyOrReturn(CheckConstraintFormat("productURL", "", "RFC3986")); + VerifyOrReturn(CheckConstraintMaxLength("productURL", productURL.size(), 256)); + NextTest(); + } + + CHIP_ERROR TestQueryProductLabel_14() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeProductLabel(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel()); + } + + void OnFailureResponse_14(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_14(chip::CharSpan productLabel) + { + VerifyOrReturn(CheckConstraintType("productLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("productLabel", productLabel.size(), 64)); + NextTest(); + } + + CHIP_ERROR TestQuerySerialNumber_15() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeSerialNumber(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); + } + + void OnFailureResponse_15(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_15(chip::CharSpan serialNumber) + { + VerifyOrReturn(CheckConstraintType("serialNumber", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("serialNumber", serialNumber.size(), 32)); + NextTest(); + } + + CHIP_ERROR TestQueryLocalConfigDisabled_16() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeLocalConfigDisabled(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel()); + } + + void OnFailureResponse_16(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_16(bool localConfigDisabled) + { + VerifyOrReturn(CheckConstraintType("localConfigDisabled", "", "boolean")); + NextTest(); + } + + CHIP_ERROR TestQueryReachable_17() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeReachable(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); + } + + void OnFailureResponse_17(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_17(bool reachable) + { + VerifyOrReturn(CheckConstraintType("reachable", "", "boolean")); + NextTest(); + } +}; + +class Test_TC_DM_3_1 : public TestCommand +{ +public: + Test_TC_DM_3_1() : TestCommand("Test_TC_DM_3_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_EMR_1_1 : public TestCommand +{ +public: + Test_TC_EMR_1_1() : TestCommand("Test_TC_EMR_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_EMR_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EMR_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 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_2(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_1(clusterRevision); + } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_2(clusterRevision); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + { + chip::Controller::ElectricalMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + { + chip::Controller::ElectricalMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument = 1U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), + clusterRevisionArgument); + } + + void OnFailureResponse_1(uint8_t status) { NextTest(); } + + void OnSuccessResponse_1(uint16_t clusterRevision) { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + { + chip::Controller::ElectricalMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); + NextTest(); + } +}; + +class Test_TC_FLW_1_1 : public TestCommand +{ +public: + Test_TC_FLW_1_1() : TestCommand("Test_TC_FLW_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_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 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } + + // + // Tests methods + // + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument = 2U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), + clusterRevisionArgument); + } + + void OnFailureResponse_0(uint8_t status) { NextTest(); } + + void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } +}; + +class Test_TC_FLW_2_1 : public TestCommand +{ +public: + Test_TC_FLW_2_1() : TestCommand("Test_TC_FLW_2_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_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 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : write the default value to optional attribute: MinMeasuredValue\n"); + err = TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : write the default value to optional attribute: MaxMeasuredValue\n"); + err = TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_7(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 8; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, int16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_0(measuredValue); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, int16_t minMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); + } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, int16_t maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, int16_t minMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_3(minMeasuredValue); + } + + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, int16_t maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_4(maxMeasuredValue); + } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, int16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_5(measuredValue); + } + + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, int16_t minMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_6(minMeasuredValue); + } + + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, int16_t maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_7(maxMeasuredValue); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(int16_t minMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(int16_t maxMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + int16_t minMeasuredValueArgument = 0; + + return cluster.WriteAttributeMinMeasuredValue(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel(), + minMeasuredValueArgument); + } + + void OnFailureResponse_3(uint8_t status) { NextTest(); } + + void OnSuccessResponse_3(int16_t minMeasuredValue) { ThrowSuccessResponse(); } + + CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + int16_t maxMeasuredValueArgument = 0; + + return cluster.WriteAttributeMaxMeasuredValue(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), + maxMeasuredValueArgument); + } + + void OnFailureResponse_4(uint8_t status) { NextTest(); } + + void OnSuccessResponse_4(int16_t maxMeasuredValue) { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_5() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_6() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(int16_t minMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_7() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(int16_t maxMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); + NextTest(); + } +}; + +class Test_TC_FLW_2_2 : public TestCommand +{ +public: + Test_TC_FLW_2_2() : TestCommand("Test_TC_FLW_2_2"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_2\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_2\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 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_1(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 2; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, int16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_0(measuredValue); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, int16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_1(measuredValue); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } +}; + +class Test_TC_LVL_1_1 : public TestCommand +{ +public: + Test_TC_LVL_1_1() : TestCommand("Test_TC_LVL_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_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 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } + + // + // Tests methods + // + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument = 4U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), + clusterRevisionArgument); + } + + void OnFailureResponse_0(uint8_t status) { NextTest(); } + + void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } +}; + +class Test_TC_LVL_2_1 : public TestCommand +{ +public: + Test_TC_LVL_2_1() : TestCommand("Test_TC_LVL_2_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_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 : reads current Level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 100ms\n"); + err = TestWait100ms_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : reads current Level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 200ms\n"); + err = TestWait200ms_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : reads current Level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : reads On Off Transition Time attribute from DUT\n"); + err = TestReadsOnOffTransitionTimeAttributeFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 10ms\n"); + err = TestWait10ms_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : reads current Level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Reset level to 0\n"); + err = TestResetLevelTo0_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); + err = TestWait100ms_12(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 13; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, + this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_0(currentLevel); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_3(currentLevel); + } + + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_6(currentLevel); + } + + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, uint16_t onOffTransitionTime) + { + (static_cast(context))->OnSuccessResponse_7(onOffTransitionTime); + } + + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_10(currentLevel); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveToLevelCommand_1() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; + request.level = 64; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR TestWait100ms_2() { return WaitForMs(100); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveToLevelCommand_4() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; + request.level = 128; + request.transitionTime = 1U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4() { NextTest(); } + + CHIP_ERROR TestWait200ms_5() { return WaitForMs(200); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + NextTest(); + } + + CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_7() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOffTransitionTime(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(uint16_t onOffTransitionTime) + { + VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveToLevelCommand_8() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; + request.level = 254; + request.transitionTime = 65535U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_8(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_8(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8() { NextTest(); } + + CHIP_ERROR TestWait10ms_9() { return WaitForMs(10); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + NextTest(); + } + + CHIP_ERROR TestResetLevelTo0_11() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; + request.level = 0; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestWait100ms_12() { return WaitForMs(100); } +}; + +class Test_TC_LVL_3_1 : public TestCommand +{ +public: + Test_TC_LVL_3_1() : TestCommand("Test_TC_LVL_3_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_3_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_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 : reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : reads max level attribute from DUT\n"); + err = TestReadsMaxLevelAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move up command\n"); + err = TestSendsAMoveUpCommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); + err = TestWait3000ms_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : reads min level attribute from DUT\n"); + err = TestReadsMinLevelAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : sends a Move down command\n"); + err = TestSendsAMoveDownCommand_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 3000ms\n"); + err = TestWait3000ms_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Write default move rate attribute from DUT\n"); + err = TestWriteDefaultMoveRateAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : reads default move rate attribute from DUT\n"); + err = TestReadsDefaultMoveRateAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : sends a Move up command at default move rate\n"); + err = TestSendsAMoveUpCommandAtDefaultMoveRate_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); + err = TestWait100ms_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_13(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 14; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_0(currentLevel); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t maxLevel) + { + (static_cast(context))->OnSuccessResponse_1(maxLevel); + } + + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_4(currentLevel); + } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint8_t minLevel) + { + (static_cast(context))->OnSuccessResponse_5(minLevel); + } + + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_8(currentLevel); + } + + static void OnFailureCallback_9(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, uint8_t defaultMoveRate) + { + (static_cast(context))->OnSuccessResponse_9(defaultMoveRate); + } + + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context, uint8_t defaultMoveRate) + { + (static_cast(context))->OnSuccessResponse_10(defaultMoveRate); + } + + static void OnFailureCallback_13(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_13(status); + } + + static void OnSuccessCallback_13(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_13(currentLevel); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + NextTest(); + } + + CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMaxLevel(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint8_t maxLevel) + { + VerifyOrReturn(CheckValue("maxLevel", maxLevel, 255)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveUpCommand_2() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Move::Type request; + request.moveMode = static_cast(0); + request.rate = 200; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestWait3000ms_3() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + } + + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 255)); + NextTest(); + } + + CHIP_ERROR TestReadsMinLevelAttributeFromDut_5() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMinLevel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint8_t minLevel) + { + VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveDownCommand_6() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Move::Type request; + request.moveMode = static_cast(1); + request.rate = 250; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_6(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_6(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6() { NextTest(); } + + CHIP_ERROR TestWait3000ms_7() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + NextTest(); + } + + CHIP_ERROR TestWriteDefaultMoveRateAttributeFromDut_9() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint8_t defaultMoveRateArgument = 20; + + return cluster.WriteAttributeDefaultMoveRate(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel(), + defaultMoveRateArgument); + } + + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9(uint8_t defaultMoveRate) { NextTest(); } + + CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_10() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeDefaultMoveRate(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(uint8_t defaultMoveRate) + { + VerifyOrReturn(CheckValue("defaultMoveRate", defaultMoveRate, 20)); + NextTest(); + } + + CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_11() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Move::Type request; + request.moveMode = static_cast(1); + request.rate = 255; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestWait100ms_12() { return WaitForMs(100); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_13() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + } + + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13(uint8_t currentLevel) + { + VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, 255)); + NextTest(); + } +}; + +class Test_TC_LVL_4_1 : public TestCommand +{ +public: + Test_TC_LVL_4_1() : TestCommand("Test_TC_LVL_4_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_4_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_4_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 : Sending on command\n"); + err = TestSendingOnCommand_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: DUT level is set to 0x80\n"); + err = TestPreconditionDutLevelIsSetTo0x80_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 3000ms\n"); + err = TestWait3000ms_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Sends step down command to DUT\n"); + err = TestSendsStepDownCommandToDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 3000ms\n"); + err = TestWait3000ms_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Sends a Step up command\n"); + err = TestSendsAStepUpCommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 3000ms\n"); + err = TestWait3000ms_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Sending off command\n"); + err = TestSendingOffCommand_10(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 11; + + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_3(currentLevel); + } + + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_6(currentLevel); + } + + static void OnFailureCallback_9(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_9(currentLevel); + } + + // + // Tests methods + // + + CHIP_ERROR TestSendingOnCommand_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Step::Type request; + request.stepMode = static_cast(0); + request.stepSize = 128; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + NextTest(); + } + + CHIP_ERROR TestSendsStepDownCommandToDut_4() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Step::Type request; + request.stepMode = static_cast(1); + request.stepSize = 64; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4() { NextTest(); } + + CHIP_ERROR TestWait3000ms_5() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + NextTest(); + } + + CHIP_ERROR TestSendsAStepUpCommand_7() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Step::Type request; + request.stepMode = static_cast(0); + request.stepSize = 64; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7() { NextTest(); } + + CHIP_ERROR TestWait3000ms_8() { return WaitForMs(3000); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + } + + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + NextTest(); + } + + CHIP_ERROR TestSendingOffCommand_10() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_10(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_10(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10() { NextTest(); } +}; + +class Test_TC_LVL_5_1 : public TestCommand +{ +public: + Test_TC_LVL_5_1() : TestCommand("Test_TC_LVL_5_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_5_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_5_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 : Sending on command\n"); + err = TestSendingOnCommand_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: DUT level is set to 0x80\n"); + err = TestPreconditionDutLevelIsSetTo0x80_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 3000ms\n"); + err = TestWait3000ms_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Sends a move up command to DUT\n"); + err = TestSendsAMoveUpCommandToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); + err = TestWait3000ms_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Sends stop command to DUT\n"); + err = TestSendsStopCommandToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Sending off command\n"); + err = TestSendingOffCommand_6(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 7; + + // + // Tests methods + // + + CHIP_ERROR TestSendingOnCommand_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Step::Type request; + request.stepMode = static_cast(0); + request.stepSize = 128; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } + + CHIP_ERROR TestSendsAMoveUpCommandToDut_3() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Move::Type request; + request.moveMode = static_cast(0); + request.rate = 1; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_3(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_3(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR TestWait3000ms_4() { return WaitForMs(3000); } + + CHIP_ERROR TestSendsStopCommandToDut_5() + { + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LevelControl::Commands::Stop::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LevelControl::Commands::Stop::Type request; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_5(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_5(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5() { NextTest(); } + + CHIP_ERROR TestSendingOffCommand_6() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_6(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_6(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6() { NextTest(); } +}; + +class Test_TC_MC_1_1 : public TestCommand +{ +public: + Test_TC_MC_1_1() : TestCommand("Test_TC_MC_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_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 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } + + // + // Tests methods + // + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + { + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument = 1U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), + clusterRevisionArgument); + } + + void OnFailureResponse_0(uint8_t status) { NextTest(); } + + void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } +}; + +class Test_TC_MC_2_1 : public TestCommand +{ +public: + Test_TC_MC_2_1() : TestCommand("Test_TC_MC_2_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_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 : Put the device into low power mode\n"); + err = TestPutTheDeviceIntoLowPowerMode_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + // + // Tests methods + // + + CHIP_ERROR TestPutTheDeviceIntoLowPowerMode_0() + { + chip::Controller::LowPowerClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::LowPower::Commands::Sleep::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::LowPower::Commands::Sleep::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } +}; + +class Test_TC_MC_3_1 : public TestCommand +{ +public: + Test_TC_MC_3_1() : TestCommand("Test_TC_MC_3_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_2 : public TestCommand +{ +public: + Test_TC_MC_3_2() : TestCommand("Test_TC_MC_3_2"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_2\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_3 : public TestCommand +{ +public: + Test_TC_MC_3_3() : TestCommand("Test_TC_MC_3_3"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_4 : public TestCommand +{ +public: + Test_TC_MC_3_4() : TestCommand("Test_TC_MC_3_4"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_5 : public TestCommand +{ +public: + Test_TC_MC_3_5() : TestCommand("Test_TC_MC_3_5"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_6 : public TestCommand +{ +public: + Test_TC_MC_3_6() : TestCommand("Test_TC_MC_3_6"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_7 : public TestCommand +{ +public: + Test_TC_MC_3_7() : TestCommand("Test_TC_MC_3_7"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_8 : public TestCommand +{ +public: + Test_TC_MC_3_8() : TestCommand("Test_TC_MC_3_8"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_9 : public TestCommand +{ +public: + Test_TC_MC_3_9() : TestCommand("Test_TC_MC_3_9"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_10 : public TestCommand +{ +public: + Test_TC_MC_3_10() : TestCommand("Test_TC_MC_3_10"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\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++) + { + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_MC_3_11 : public TestCommand +{ +public: + Test_TC_MC_3_11() : TestCommand("Test_TC_MC_3_11"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 0; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; + Wait(); - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; + // 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++) + { + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_11() { NextTest(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; - CHIP_ERROR TestWait100ms_12() { return WaitForMs(100); } + // + // Tests methods + // }; -class Test_TC_LVL_3_1 : public TestCommand +class Test_TC_OCC_1_1 : public TestCommand { public: - Test_TC_LVL_3_1() : TestCommand("Test_TC_LVL_3_1"), mTestIndex(0) {} + Test_TC_OCC_1_1() : TestCommand("Test_TC_OCC_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -11406,12 +14448,12 @@ class Test_TC_LVL_3_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_3_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -11425,60 +14467,13 @@ class Test_TC_LVL_3_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads max level attribute from DUT\n"); - err = TestReadsMaxLevelAttributeFromDut_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move up command\n"); - err = TestSendsAMoveUpCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); - err = TestWait3000ms_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : reads min level attribute from DUT\n"); - err = TestReadsMinLevelAttributeFromDut_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : sends a Move down command\n"); - err = TestSendsAMoveDownCommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait 3000ms\n"); - err = TestWait3000ms_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Write default move rate attribute from DUT\n"); - err = TestWriteDefaultMoveRateAttributeFromDut_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads default move rate attribute from DUT\n"); - err = TestReadsDefaultMoveRateAttributeFromDut_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : sends a Move up command at default move rate\n"); - err = TestSendsAMoveUpCommandAtDefaultMoveRate_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); - err = TestWait100ms_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_13(); + ChipLogProgress(chipTool, + " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); break; } @@ -11491,536 +14486,420 @@ class Test_TC_LVL_3_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + const uint16_t mTestCount = 2; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; - chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; - chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; - chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context, uint8_t currentLevel) + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_0(currentLevel); + (static_cast(context))->OnSuccessResponse_0(clusterRevision); } static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); - } - - static void OnSuccessCallback_1(void * context, uint8_t maxLevel) - { - (static_cast(context))->OnSuccessResponse_1(maxLevel); - } - - static void OnFailureCallback_4(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_4(status); - } - - static void OnSuccessCallback_4(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_4(currentLevel); - } - - static void OnFailureCallback_5(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_5(status); - } - - static void OnSuccessCallback_5(void * context, uint8_t minLevel) - { - (static_cast(context))->OnSuccessResponse_5(minLevel); - } - - static void OnFailureCallback_8(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_8(status); - } - - static void OnSuccessCallback_8(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_8(currentLevel); - } - - static void OnFailureCallback_9(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_9(status); - } - - static void OnSuccessCallback_9(void * context, uint8_t defaultMoveRate) - { - (static_cast(context))->OnSuccessResponse_9(defaultMoveRate); - } - - static void OnFailureCallback_10(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_10(status); - } - - static void OnSuccessCallback_10(void * context, uint8_t defaultMoveRate) - { - (static_cast(context))->OnSuccessResponse_10(defaultMoveRate); - } - - static void OnFailureCallback_13(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_13(status); - } - - static void OnSuccessCallback_13(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_13(currentLevel); - } - - // - // Tests methods - // - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); - } - - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); - NextTest(); - } - - CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeMaxLevel(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); - } - - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1(uint8_t maxLevel) - { - VerifyOrReturn(CheckValue("maxLevel", maxLevel, 255)); - NextTest(); - } - - CHIP_ERROR TestSendsAMoveUpCommand_2() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LevelControl::Commands::Move::Type request; - request.moveMode = static_cast(0); - request.rate = 200; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + (static_cast(context))->OnFailureResponse_1(status); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_2() { NextTest(); } + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_1(clusterRevision); + } - CHIP_ERROR TestWait3000ms_3() { return WaitForMs(3000); } + // + // Tests methods + // - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::OccupancySensingClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint8_t currentLevel) + void OnSuccessResponse_0(uint16_t clusterRevision) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 255)); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 2U)); NextTest(); } - CHIP_ERROR TestReadsMinLevelAttributeFromDut_5() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::OccupancySensingClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMinLevel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + uint16_t clusterRevisionArgument = 2U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), + clusterRevisionArgument); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { NextTest(); } - void OnSuccessResponse_5(uint8_t minLevel) - { - VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); - NextTest(); - } + void OnSuccessResponse_1(uint16_t clusterRevision) { ThrowSuccessResponse(); } +}; - CHIP_ERROR TestSendsAMoveDownCommand_6() +class Test_TC_OCC_2_1 : public TestCommand +{ +public: + Test_TC_OCC_2_1() : TestCommand("Test_TC_OCC_2_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + CHIP_ERROR err = CHIP_NO_ERROR; - using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - using responseType = chip::app::DataModel::NullObjectType; + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_1\n"); + } - chip::app::Clusters::LevelControl::Commands::Move::Type request; - request.moveMode = static_cast(1); - request.rate = 250; - request.optionMask = 1; - request.optionOverride = 1; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; + Wait(); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } + // 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 : Reads mandatory attribute constrains: Occupancy\n"); + err = TestReadsMandatoryAttributeConstrainsOccupancy_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : Writes the respective default value to mandatory attribute: Occupancy\n"); + err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back mandatory attribute: Occupancy\n"); + err = TestReadsBackMandatoryAttributeOccupancy_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads mandatory attribute constrains: OccupancySensorType\n"); + err = TestReadsMandatoryAttributeConstrainsOccupancySensorType_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Writes the respective default value to mandatory attribute: OccupancySensorType\n"); + err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads back mandatory attribute: OccupancySensorType\n"); + err = TestReadsBackMandatoryAttributeOccupancySensorType_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads mandatory attribute constrains: OccupancySensorTypeBitmap\n"); + err = TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6(); + break; + case 7: + ChipLogProgress( + chipTool, + " ***** Test Step 7 : Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap\n"); + err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads back mandatory attribute: OccupancySensorTypeBitmap\n"); + err = TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8(); + break; + } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } - void OnSuccessResponse_6() { NextTest(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 9; - CHIP_ERROR TestWait3000ms_7() { return WaitForMs(3000); } + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, + this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, + this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, + this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, + this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, + this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, + this }; - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() + static void OnFailureCallback_0(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + (static_cast(context))->OnFailureResponse_0(status); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_8(uint8_t currentLevel) + static void OnSuccessCallback_0(void * context, uint8_t occupancy) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); - NextTest(); + (static_cast(context))->OnSuccessResponse_0(occupancy); } - CHIP_ERROR TestWriteDefaultMoveRateAttributeFromDut_9() + static void OnFailureCallback_1(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_1(status); + } - uint8_t defaultMoveRateArgument = 20; + static void OnSuccessCallback_1(void * context, uint8_t occupancy) + { + (static_cast(context))->OnSuccessResponse_1(occupancy); + } - return cluster.WriteAttributeDefaultMoveRate(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel(), - defaultMoveRateArgument); + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_2(void * context, uint8_t occupancy) + { + (static_cast(context))->OnSuccessResponse_2(occupancy); + } - void OnSuccessResponse_9(uint8_t defaultMoveRate) { NextTest(); } + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } - CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_10() + static void OnSuccessCallback_3(void * context, uint8_t occupancySensorType) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_3(occupancySensorType); + } - return cluster.ReadAttributeDefaultMoveRate(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_4(void * context, uint8_t occupancySensorType) + { + (static_cast(context))->OnSuccessResponse_4(occupancySensorType); + } - void OnSuccessResponse_10(uint8_t defaultMoveRate) + static void OnFailureCallback_5(void * context, uint8_t status) { - VerifyOrReturn(CheckValue("defaultMoveRate", defaultMoveRate, 20)); - NextTest(); + (static_cast(context))->OnFailureResponse_5(status); } - CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_11() + static void OnSuccessCallback_5(void * context, uint8_t occupancySensorType) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_5(occupancySensorType); + } - using requestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - using responseType = chip::app::DataModel::NullObjectType; + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } - chip::app::Clusters::LevelControl::Commands::Move::Type request; - request.moveMode = static_cast(1); - request.rate = 255; - request.optionMask = 1; - request.optionOverride = 1; + static void OnSuccessCallback_6(void * context, uint8_t occupancySensorTypeBitmap) + { + (static_cast(context))->OnSuccessResponse_6(occupancySensorTypeBitmap); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + static void OnSuccessCallback_7(void * context, uint8_t occupancySensorTypeBitmap) + { + (static_cast(context))->OnSuccessResponse_7(occupancySensorTypeBitmap); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } - void OnSuccessResponse_11() { NextTest(); } + static void OnSuccessCallback_8(void * context, uint8_t occupancySensorTypeBitmap) + { + (static_cast(context))->OnSuccessResponse_8(occupancySensorTypeBitmap); + } - CHIP_ERROR TestWait100ms_12() { return WaitForMs(100); } + // + // Tests methods + // - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_13() + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancy_0() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::OccupancySensingClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + return cluster.ReadAttributeOccupancy(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_13(uint8_t currentLevel) + void OnSuccessResponse_0(uint8_t occupancy) { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, 255)); + VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + VerifyOrReturn(CheckConstraintMaxValue("occupancy", occupancy, 1)); NextTest(); } -}; -class Test_TC_MC_1_1 : public TestCommand -{ -public: - Test_TC_MC_1_1() : TestCommand("Test_TC_MC_1_1"), mTestIndex(0) {} - - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); - } + uint8_t occupancyArgument = 0; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + return cluster.WriteAttributeOccupancy(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), occupancyArgument); + } - Wait(); + void OnFailureResponse_1(uint8_t status) { NextTest(); } - // 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 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); - break; - } + void OnSuccessResponse_1(uint8_t occupancy) { ThrowSuccessResponse(); } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancy_2() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + return cluster.ReadAttributeOccupancy(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_0(void * context, uint8_t status) + void OnSuccessResponse_2(uint8_t occupancy) { - (static_cast(context))->OnFailureResponse_0(status); + VerifyOrReturn(CheckValue("occupancy", occupancy, 0)); + NextTest(); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorType_3() { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } - // - // Tests methods - // + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + void OnSuccessResponse_3(uint8_t occupancySensorType) { - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + VerifyOrReturn(CheckConstraintType("occupancySensorType", "", "enum8")); + VerifyOrReturn(CheckConstraintMaxValue("occupancySensorType", occupancySensorType, 3)); + NextTest(); + } + + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4() + { + chip::Controller::OccupancySensingClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument = 1U; + uint8_t occupancySensorTypeArgument = static_cast(0); - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), - clusterRevisionArgument); + return cluster.WriteAttributeOccupancySensorType(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), + occupancySensorTypeArgument); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } - - void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } -}; + void OnFailureResponse_4(uint8_t status) { NextTest(); } -class Test_TC_MC_2_1 : public TestCommand -{ -public: - Test_TC_MC_2_1() : TestCommand("Test_TC_MC_2_1"), mTestIndex(0) {} + void OnSuccessResponse_4(uint8_t occupancySensorType) { ThrowSuccessResponse(); } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorType_5() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); - } + return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_5(uint8_t occupancySensorType) + { + VerifyOrReturn(CheckValue("occupancySensorType", occupancySensorType, 0)); + NextTest(); + } - // 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 : Put the device into low power mode\n"); - err = TestPutTheDeviceIntoLowPowerMode_0(); - break; - } + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_6(uint8_t occupancySensorTypeBitmap) + { + VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); + VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 7)); + NextTest(); + } - CHIP_ERROR TestPutTheDeviceIntoLowPowerMode_0() + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7() { - chip::Controller::LowPowerClusterTest cluster; + chip::Controller::OccupancySensingClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::LowPower::Commands::Sleep::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::LowPower::Commands::Sleep::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); - }; + uint8_t occupancySensorTypeBitmapArgument = 1; - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.WriteAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel(), + occupancySensorTypeBitmapArgument); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0() { NextTest(); } -}; + void OnFailureResponse_7(uint8_t status) { NextTest(); } -class Test_TC_MC_3_1 : public TestCommand -{ -public: - Test_TC_MC_3_1() : TestCommand("Test_TC_MC_3_1"), mTestIndex(0) {} + void OnSuccessResponse_7(uint8_t occupancySensorTypeBitmap) { ThrowSuccessResponse(); } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); - } - - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_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++) - { - } + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_8(uint8_t occupancySensorTypeBitmap) + { + VerifyOrReturn(CheckValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); + NextTest(); + } }; -class Test_TC_MC_3_2 : public TestCommand +class Test_TC_OCC_2_2 : public TestCommand { public: - Test_TC_MC_3_2() : TestCommand("Test_TC_MC_3_2"), mTestIndex(0) {} + Test_TC_OCC_2_2() : TestCommand("Test_TC_OCC_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -12029,12 +14908,12 @@ class Test_TC_MC_3_2 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -12047,6 +14926,14 @@ class Test_TC_MC_3_2 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Reads Occupancy attribute from DUT\n"); + err = TestReadsOccupancyAttributeFromDut_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads Occupancy attribute from DUT\n"); + err = TestReadsOccupancyAttributeFromDut_1(); + break; } if (CHIP_NO_ERROR != err) @@ -12058,17 +14945,74 @@ class Test_TC_MC_3_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + const uint16_t mTestCount = 2; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint8_t occupancy) + { + (static_cast(context))->OnSuccessResponse_0(occupancy); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t occupancy) + { + (static_cast(context))->OnSuccessResponse_1(occupancy); + } // // Tests methods // + + CHIP_ERROR TestReadsOccupancyAttributeFromDut_0() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancy(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint8_t occupancy) + { + VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + NextTest(); + } + + CHIP_ERROR TestReadsOccupancyAttributeFromDut_1() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancy(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint8_t occupancy) + { + VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + NextTest(); + } }; -class Test_TC_MC_3_3 : public TestCommand +class Test_TC_OO_1_1 : public TestCommand { public: - Test_TC_MC_3_3() : TestCommand("Test_TC_MC_3_3"), mTestIndex(0) {} + Test_TC_OO_1_1() : TestCommand("Test_TC_OO_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -12077,12 +15021,12 @@ class Test_TC_MC_3_3 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -12095,6 +15039,31 @@ class Test_TC_MC_3_3 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : write the default values to optional global attribute: FeatureMap\n"); + err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : reads back optional global attribute: FeatureMap\n"); + err = TestReadsBackOptionalGlobalAttributeFeatureMap_5(); + break; } if (CHIP_NO_ERROR != err) @@ -12104,19 +15073,185 @@ class Test_TC_MC_3_3 : public TestCommand } } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 6; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_1(clusterRevision); + } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_2(clusterRevision); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_3(featureMap); + } + + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_4(featureMap); + } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_5(featureMap); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument = 3U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), + clusterRevisionArgument); + } + + void OnFailureResponse_1(uint8_t status) { NextTest(); } + + void OnSuccessResponse_1(uint16_t clusterRevision) { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); + NextTest(); + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_3() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint32_t featureMap) + { + VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_4() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint32_t featureMapArgument = 0UL; + + return cluster.WriteAttributeFeatureMap(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), featureMapArgument); + } + + void OnFailureResponse_4(uint8_t status) { NextTest(); } + + void OnSuccessResponse_4(uint32_t featureMap) { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_5() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_5(uint32_t featureMap) + { + VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + NextTest(); + } }; -class Test_TC_MC_3_4 : public TestCommand +class Test_TC_OO_2_1 : public TestCommand { public: - Test_TC_MC_3_4() : TestCommand("Test_TC_MC_3_4"), mTestIndex(0) {} + Test_TC_OO_2_1() : TestCommand("Test_TC_OO_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -12125,12 +15260,12 @@ class Test_TC_MC_3_4 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -12143,6 +15278,54 @@ class Test_TC_MC_3_4 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: OnOff\n"); + err = TestReadTheMandatoryAttributeOnOff_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : reads back mandatory attribute: OnOff\n"); + err = TestReadsBackMandatoryAttributeOnOff_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : read LT attribute: GlobalSceneControl\n"); + err = TestReadLtAttributeGlobalSceneControl_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : read LT attribute: OnTime\n"); + err = TestReadLtAttributeOnTime_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : read LT attribute: OffWaitTime\n"); + err = TestReadLtAttributeOffWaitTime_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : read LT attribute: StartUpOnOff\n"); + err = TestReadLtAttributeStartUpOnOff_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : write the default value to LT attribute: OnTime\n"); + err = TestWriteTheDefaultValueToLtAttributeOnTime_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : write the default value to LT attribute: OffWaitTime\n"); + err = TestWriteTheDefaultValueToLtAttributeOffWaitTime_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : write the default value to LT attribute: StartUpOnOff\n"); + err = TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : reads back LT attribute: OnTime\n"); + err = TestReadsBackLtAttributeOnTime_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : reads back LT attribute: OffWaitTime\n"); + err = TestReadsBackLtAttributeOffWaitTime_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : reads back LT attribute: StartUpOnOff\n"); + err = TestReadsBackLtAttributeStartUpOnOff_11(); + break; } if (CHIP_NO_ERROR != err) @@ -12154,353 +15337,349 @@ class Test_TC_MC_3_4 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + const uint16_t mTestCount = 12; - // - // Tests methods - // -}; + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; + chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; -class Test_TC_MC_3_5 : public TestCommand -{ -public: - Test_TC_MC_3_5() : TestCommand("Test_TC_MC_3_5"), mTestIndex(0) {} + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnSuccessCallback_0(void * context, bool onOff) { - CHIP_ERROR err = CHIP_NO_ERROR; + (static_cast(context))->OnSuccessResponse_0(onOff); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); - } + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnSuccessCallback_1(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_1(onOff); + } - Wait(); + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } - // 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++) - { - } + static void OnSuccessCallback_2(void * context, bool globalSceneControl) + { + (static_cast(context))->OnSuccessResponse_2(globalSceneControl); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + static void OnSuccessCallback_3(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_3(onTime); + } - // - // Tests methods - // -}; + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } -class Test_TC_MC_3_6 : public TestCommand -{ -public: - Test_TC_MC_3_6() : TestCommand("Test_TC_MC_3_6"), mTestIndex(0) {} + static void OnSuccessCallback_4(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_4(offWaitTime); + } - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnFailureCallback_5(void * context, uint8_t status) { - CHIP_ERROR err = CHIP_NO_ERROR; + (static_cast(context))->OnFailureResponse_5(status); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); - } + static void OnSuccessCallback_5(void * context, uint8_t startUpOnOff) + { + (static_cast(context))->OnSuccessResponse_5(startUpOnOff); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } - Wait(); + static void OnSuccessCallback_6(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_6(onTime); + } - // 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++) - { - } + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_7(offWaitTime); + } + + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, uint8_t startUpOnOff) + { + (static_cast(context))->OnSuccessResponse_8(startUpOnOff); + } + + static void OnFailureCallback_9(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_9(onTime); + } + + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_10(offWaitTime); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnFailureCallback_11(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_11(status); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + static void OnSuccessCallback_11(void * context, uint8_t startUpOnOff) + { + (static_cast(context))->OnSuccessResponse_11(startUpOnOff); + } // // Tests methods // -}; - -class Test_TC_MC_3_7 : public TestCommand -{ -public: - Test_TC_MC_3_7() : TestCommand("Test_TC_MC_3_7"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadTheMandatoryAttributeOnOff_0() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); - } + return cluster.ReadAttributeOnOff(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_0(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); + } - // 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++) - { - } + CHIP_ERROR TestReadsBackMandatoryAttributeOnOff_1() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - // - // Tests methods - // -}; + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } -class Test_TC_MC_3_8 : public TestCommand -{ -public: - Test_TC_MC_3_8() : TestCommand("Test_TC_MC_3_8"), mTestIndex(0) {} + void OnSuccessResponse_1(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); + } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadLtAttributeGlobalSceneControl_2() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); - } + return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_2(bool globalSceneControl) + { + VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); + NextTest(); + } - // 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++) - { - } + CHIP_ERROR TestReadLtAttributeOnTime_3() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeOnTime(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - // - // Tests methods - // -}; + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } -class Test_TC_MC_3_9 : public TestCommand -{ -public: - Test_TC_MC_3_9() : TestCommand("Test_TC_MC_3_9"), mTestIndex(0) {} + void OnSuccessResponse_3(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadLtAttributeOffWaitTime_4() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); - } + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_4(uint16_t offWaitTime) + { + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + NextTest(); + } - // 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++) - { - } + CHIP_ERROR TestReadLtAttributeStartUpOnOff_5() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // -}; + void OnSuccessResponse_5(uint8_t startUpOnOff) + { + VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + NextTest(); + } -class Test_TC_MC_3_10 : public TestCommand -{ -public: - Test_TC_MC_3_10() : TestCommand("Test_TC_MC_3_10"), mTestIndex(0) {} + CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOnTime_6() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - /////////// TestCommand Interface ///////// - void NextTest() override + uint16_t onTimeArgument = 0U; + + return cluster.WriteAttributeOnTime(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel(), onTimeArgument); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(uint16_t onTime) { NextTest(); } + + CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOffWaitTime_7() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); - } + uint16_t offWaitTimeArgument = 0U; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + return cluster.WriteAttributeOffWaitTime(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel(), offWaitTimeArgument); + } - Wait(); + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - // 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++) - { - } + void OnSuccessResponse_7(uint16_t offWaitTime) { NextTest(); } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + CHIP_ERROR TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint8_t startUpOnOffArgument = static_cast(0); + + return cluster.WriteAttributeStartUpOnOff(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel(), + startUpOnOffArgument); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // -}; + void OnSuccessResponse_8(uint8_t startUpOnOff) { NextTest(); } -class Test_TC_MC_3_11 : public TestCommand -{ -public: - Test_TC_MC_3_11() : TestCommand("Test_TC_MC_3_11"), mTestIndex(0) {} + CHIP_ERROR TestReadsBackLtAttributeOnTime_9() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - /////////// TestCommand Interface ///////// - void NextTest() override + return cluster.ReadAttributeOnTime(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + } + + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9(uint16_t onTime) { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); - } + CHIP_ERROR TestReadsBackLtAttributeOffWaitTime_10() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + } - Wait(); + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - // 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++) - { - } + void OnSuccessResponse_10(uint16_t offWaitTime) + { + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + NextTest(); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + CHIP_ERROR TestReadsBackLtAttributeStartUpOnOff_11() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_11(uint8_t startUpOnOff) + { + VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + NextTest(); + } }; -class Test_TC_OCC_1_1 : public TestCommand +class Test_TC_OO_2_2 : public TestCommand { public: - Test_TC_OCC_1_1() : TestCommand("Test_TC_OCC_1_1"), mTestIndex(0) {} + Test_TC_OO_2_2() : TestCommand("Test_TC_OO_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -12509,12 +15688,12 @@ class Test_TC_OCC_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -12528,13 +15707,60 @@ class Test_TC_OCC_1_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Send Off Command\n"); + err = TestSendOffCommand_0(); break; case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Send On Command\n"); + err = TestSendOnCommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Check on/off attribute value is true after on command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Send Off Command\n"); + err = TestSendOffCommand_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Send Toggle Command\n"); + err = TestSendToggleCommand_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Check on/off attribute value is true after toggle command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Send Toggle Command\n"); + err = TestSendToggleCommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Check on/off attribute value is false after toggle command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Send On Command\n"); + err = TestSendOnCommand_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Check on/off attribute value is true after on command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Send Off Command\n"); + err = TestSendOffCommand_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13(); break; } @@ -12547,420 +15773,559 @@ class Test_TC_OCC_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 14; - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; + chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_1(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_1(onOff); } - static void OnFailureCallback_1(void * context, uint8_t status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_3(onOff); + } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_5(onOff); + } + + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_7(onOff); + } + + static void OnFailureCallback_9(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_9(onOff); + } + + static void OnFailureCallback_11(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_11(status); + } + + static void OnSuccessCallback_11(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_11(onOff); + } + + static void OnFailureCallback_13(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_13(status); + } + + static void OnSuccessCallback_13(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_13(onOff); + } + + // + // Tests methods + // + + CHIP_ERROR TestSendOffCommand_0() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_0(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_0(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); - } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_0() { NextTest(); } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint16_t clusterRevision) + void OnSuccessResponse_1(bool onOff) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 2U)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + CHIP_ERROR TestSendOnCommand_2() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument = 2U; + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), - clusterRevisionArgument); + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(uint16_t clusterRevision) { ThrowSuccessResponse(); } -}; + void OnSuccessResponse_2() { NextTest(); } -class Test_TC_OCC_2_1 : public TestCommand -{ -public: - Test_TC_OCC_2_1() : TestCommand("Test_TC_OCC_2_1"), mTestIndex(0) {} + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - /////////// TestCommand Interface ///////// - void NextTest() override + return cluster.ReadAttributeOnOff(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(bool onOff) { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_1\n"); - } + CHIP_ERROR TestSendOffCommand_4() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - Wait(); + chip::app::Clusters::OnOff::Commands::Off::Type request; - // 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 : Reads mandatory attribute constrains: Occupancy\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancy_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : Writes the respective default value to mandatory attribute: Occupancy\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back mandatory attribute: Occupancy\n"); - err = TestReadsBackMandatoryAttributeOccupancy_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads mandatory attribute constrains: OccupancySensorType\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorType_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Writes the respective default value to mandatory attribute: OccupancySensorType\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads back mandatory attribute: OccupancySensorType\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorType_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads mandatory attribute constrains: OccupancySensorTypeBitmap\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6(); - break; - case 7: - ChipLogProgress( - chipTool, - " ***** Test Step 7 : Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads back mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8(); - break; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, - this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, - this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, - this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, - this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, - this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, - this }; + void OnSuccessResponse_4() { NextTest(); } - static void OnFailureCallback_0(void * context, uint8_t status) + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() { - (static_cast(context))->OnFailureResponse_0(status); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_0(void * context, uint8_t occupancy) - { - (static_cast(context))->OnSuccessResponse_0(occupancy); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } - static void OnFailureCallback_1(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_1(status); - } + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - static void OnSuccessCallback_1(void * context, uint8_t occupancy) + void OnSuccessResponse_5(bool onOff) { - (static_cast(context))->OnSuccessResponse_1(occupancy); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); } - static void OnFailureCallback_2(void * context, uint8_t status) + CHIP_ERROR TestSendToggleCommand_6() { - (static_cast(context))->OnFailureResponse_2(status); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_2(void * context, uint8_t occupancy) - { - (static_cast(context))->OnSuccessResponse_2(occupancy); - } + using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; + using responseType = chip::app::DataModel::NullObjectType; - static void OnFailureCallback_3(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_3(status); - } + chip::app::Clusters::OnOff::Commands::Toggle::Type request; - static void OnSuccessCallback_3(void * context, uint8_t occupancySensorType) - { - (static_cast(context))->OnSuccessResponse_3(occupancySensorType); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_6(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_6(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnFailureCallback_4(void * context, uint8_t status) + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6() { NextTest(); } + + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7() { - (static_cast(context))->OnFailureResponse_4(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); } - static void OnSuccessCallback_4(void * context, uint8_t occupancySensorType) + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(bool onOff) { - (static_cast(context))->OnSuccessResponse_4(occupancySensorType); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); } - static void OnFailureCallback_5(void * context, uint8_t status) + CHIP_ERROR TestSendToggleCommand_8() { - (static_cast(context))->OnFailureResponse_5(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Toggle::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_8(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_8(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnSuccessCallback_5(void * context, uint8_t occupancySensorType) - { - (static_cast(context))->OnSuccessResponse_5(occupancySensorType); - } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_6(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_6(status); - } + void OnSuccessResponse_8() { NextTest(); } - static void OnSuccessCallback_6(void * context, uint8_t occupancySensorTypeBitmap) + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9() { - (static_cast(context))->OnSuccessResponse_6(occupancySensorTypeBitmap); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_7(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_7(status); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } - static void OnSuccessCallback_7(void * context, uint8_t occupancySensorTypeBitmap) - { - (static_cast(context))->OnSuccessResponse_7(occupancySensorTypeBitmap); - } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_8(void * context, uint8_t status) + void OnSuccessResponse_9(bool onOff) { - (static_cast(context))->OnFailureResponse_8(status); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); } - static void OnSuccessCallback_8(void * context, uint8_t occupancySensorTypeBitmap) + CHIP_ERROR TestSendOnCommand_10() { - (static_cast(context))->OnSuccessResponse_8(occupancySensorTypeBitmap); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::On::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_10(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_10(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - // - // Tests methods - // + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancy_0() + void OnSuccessResponse_10() { NextTest(); } + + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint8_t occupancy) + void OnSuccessResponse_11(bool onOff) { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); - VerifyOrReturn(CheckConstraintMaxValue("occupancy", occupancy, 1)); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1() + CHIP_ERROR TestSendOffCommand_12() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t occupancyArgument = 0; + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttributeOccupancy(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), occupancyArgument); + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_12(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_12(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(uint8_t occupancy) { ThrowSuccessResponse(); } + void OnSuccessResponse_12() { NextTest(); } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancy_2() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t occupancy) + void OnSuccessResponse_13(bool onOff) { - VerifyOrReturn(CheckValue("occupancy", occupancy, 0)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } +}; - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorType_3() +class Test_TC_PRS_1_1 : public TestCommand +{ +public: + Test_TC_PRS_1_1() : TestCommand("Test_TC_PRS_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevice, 1); + CHIP_ERROR err = CHIP_NO_ERROR; - return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_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 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, + " ***** Test Step 2 : Write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_3(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; - void OnSuccessResponse_3(uint8_t occupancySensorType) + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) { - VerifyOrReturn(CheckConstraintType("occupancySensorType", "", "enum8")); - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorType", occupancySensorType, 3)); - NextTest(); + (static_cast(context))->OnFailureResponse_0(status); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4() + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) { - chip::Controller::OccupancySensingClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } - uint8_t occupancySensorTypeArgument = static_cast(0); + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } - return cluster.WriteAttributeOccupancySensorType(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), - occupancySensorTypeArgument); + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_1(clusterRevision); } - void OnFailureResponse_4(uint8_t status) { NextTest(); } + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } - void OnSuccessResponse_4(uint8_t occupancySensorType) { ThrowSuccessResponse(); } + static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_2(clusterRevision); + } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorType_5() + static void OnFailureCallback_3(void * context, uint8_t status) { - chip::Controller::OccupancySensingClusterTest cluster; + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_3(clusterRevision); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + { + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint8_t occupancySensorType) + void OnSuccessResponse_0(uint16_t clusterRevision) { - VerifyOrReturn(CheckValue("occupancySensorType", occupancySensorType, 0)); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 2U)); NextTest(); } - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(uint8_t occupancySensorTypeBitmap) + void OnSuccessResponse_1(uint16_t clusterRevision) { - VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 7)); + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t occupancySensorTypeBitmapArgument = 1; + uint16_t clusterRevisionArgument = 2U; - return cluster.WriteAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel(), - occupancySensorTypeBitmapArgument); + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), + clusterRevisionArgument); } - void OnFailureResponse_7(uint8_t status) { NextTest(); } + void OnFailureResponse_2(uint8_t status) { NextTest(); } - void OnSuccessResponse_7(uint8_t occupancySensorTypeBitmap) { ThrowSuccessResponse(); } + void OnSuccessResponse_2(uint16_t clusterRevision) { ThrowSuccessResponse(); } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8() + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_3() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint8_t occupancySensorTypeBitmap) + void OnSuccessResponse_3(uint16_t clusterRevision) { - VerifyOrReturn(CheckValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 2U)); NextTest(); } }; -class Test_TC_OO_1_1 : public TestCommand +class Test_TC_PRS_2_1 : public TestCommand { public: - Test_TC_OO_1_1() : TestCommand("Test_TC_OO_1_1"), mTestIndex(0) {} + Test_TC_PRS_2_1() : TestCommand("Test_TC_PRS_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -12969,12 +16334,12 @@ class Test_TC_OO_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PRS_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PRS_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -12988,29 +16353,40 @@ class Test_TC_OO_1_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Read the mandatory attribute constraints: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeConstraintsMeasuredValue_0(); break; case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Write the default values to mandatory attribute: MeasuredValue\n"); + err = TestWriteTheDefaultValuesToMandatoryAttributeMeasuredValue_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back mandatory attribute: MeasuredValue\n"); + err = TestReadsBackMandatoryAttributeMeasuredValue_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the mandatory attribute constraints: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeConstraintsMinMeasuredValue_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Write the default values to mandatory attribute: MinMeasuredValue\n"); + err = TestWriteTheDefaultValuesToMandatoryAttributeMinMeasuredValue_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads back mandatory attribute: MinMeasuredValue\n"); + err = TestReadsBackMandatoryAttributeMinMeasuredValue_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read the mandatory attribute constraints: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeConstraintsMaxMeasuredValue_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Write the default values to mandatory attribute: MaxMeasuredValue\n"); + err = TestWriteTheDefaultValuesToMandatoryAttributeMaxMeasuredValue_7(); break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : reads back optional global attribute: FeatureMap\n"); - err = TestReadsBackOptionalGlobalAttributeFeatureMap_5(); + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads back mandatory attribute: MaxMeasuredValue\n"); + err = TestReadsBackMandatoryAttributeMaxMeasuredValue_8(); break; } @@ -13023,183 +16399,267 @@ class Test_TC_OO_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 9; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_0(void * context, int16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_0(measuredValue); } static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_1(void * context, int16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); + (static_cast(context))->OnSuccessResponse_1(measuredValue); } static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_2(void * context, int16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + (static_cast(context))->OnSuccessResponse_2(measuredValue); } static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_3(void * context, uint32_t featureMap) + static void OnSuccessCallback_3(void * context, int16_t minMeasuredValue) { - (static_cast(context))->OnSuccessResponse_3(featureMap); + (static_cast(context))->OnSuccessResponse_3(minMeasuredValue); } static void OnFailureCallback_4(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_4(void * context, uint32_t featureMap) + static void OnSuccessCallback_4(void * context, int16_t minMeasuredValue) { - (static_cast(context))->OnSuccessResponse_4(featureMap); + (static_cast(context))->OnSuccessResponse_4(minMeasuredValue); } static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_5(status); } - static void OnSuccessCallback_5(void * context, uint32_t featureMap) + static void OnSuccessCallback_5(void * context, int16_t minMeasuredValue) { - (static_cast(context))->OnSuccessResponse_5(featureMap); + (static_cast(context))->OnSuccessResponse_5(minMeasuredValue); + } + + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, int16_t maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_6(maxMeasuredValue); + } + + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, int16_t maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_7(maxMeasuredValue); + } + + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, int16_t maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_8(maxMeasuredValue); } // // Tests methods // - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMeasuredValue_0() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint16_t clusterRevision) + void OnSuccessResponse_0(int16_t measuredValue) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMeasuredValue_1() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument = 3U; + int16_t measuredValueArgument = 0; - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), - clusterRevisionArgument); + return cluster.WriteAttributeMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), + measuredValueArgument); } void OnFailureResponse_1(uint8_t status) { NextTest(); } - void OnSuccessResponse_1(uint16_t clusterRevision) { ThrowSuccessResponse(); } + void OnSuccessResponse_1(int16_t measuredValue) { ThrowSuccessResponse(); } - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + CHIP_ERROR TestReadsBackMandatoryAttributeMeasuredValue_2() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint16_t clusterRevision) + void OnSuccessResponse_2(int16_t measuredValue) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); + VerifyOrReturn(CheckValue("measuredValue", measuredValue, 0)); NextTest(); } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_3() + CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMinMeasuredValue_3() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint32_t featureMap) + void OnSuccessResponse_3(int16_t minMeasuredValue) { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_4() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMinMeasuredValue_4() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - uint32_t featureMapArgument = 0UL; + int16_t minMeasuredValueArgument = 0; - return cluster.WriteAttributeFeatureMap(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), featureMapArgument); + return cluster.WriteAttributeMinMeasuredValue(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), + minMeasuredValueArgument); } void OnFailureResponse_4(uint8_t status) { NextTest(); } - void OnSuccessResponse_4(uint32_t featureMap) { ThrowSuccessResponse(); } + void OnSuccessResponse_4(int16_t minMeasuredValue) { ThrowSuccessResponse(); } - CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_5() + CHIP_ERROR TestReadsBackMandatoryAttributeMinMeasuredValue_5() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PressureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint32_t featureMap) + void OnSuccessResponse_5(int16_t minMeasuredValue) { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + VerifyOrReturn(CheckValue("minMeasuredValue", minMeasuredValue, 0)); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeConstraintsMaxMeasuredValue_6() + { + chip::Controller::PressureMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(int16_t maxMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryAttributeMaxMeasuredValue_7() + { + chip::Controller::PressureMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + int16_t maxMeasuredValueArgument = 0; + + return cluster.WriteAttributeMaxMeasuredValue(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel(), + maxMeasuredValueArgument); + } + + void OnFailureResponse_7(uint8_t status) { NextTest(); } + + void OnSuccessResponse_7(int16_t maxMeasuredValue) { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackMandatoryAttributeMaxMeasuredValue_8() + { + chip::Controller::PressureMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(int16_t maxMeasuredValue) + { + VerifyOrReturn(CheckValue("maxMeasuredValue", maxMeasuredValue, 0)); NextTest(); } }; -class Test_TC_OO_2_1 : public TestCommand +class Test_TC_PCC_1_1 : public TestCommand { public: - Test_TC_OO_2_1() : TestCommand("Test_TC_OO_2_1"), mTestIndex(0) {} + Test_TC_PCC_1_1() : TestCommand("Test_TC_PCC_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -13208,12 +16668,12 @@ class Test_TC_OO_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -13227,52 +16687,117 @@ class Test_TC_OO_2_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: OnOff\n"); - err = TestReadTheMandatoryAttributeOnOff_0(); + ChipLogProgress(chipTool, + " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } + + // + // Tests methods + // + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + { + chip::Controller::PumpConfigurationAndControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument = 3U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), + clusterRevisionArgument); + } + + void OnFailureResponse_0(uint8_t status) { NextTest(); } + + void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } +}; + +class Test_TC_PCC_2_1 : public TestCommand +{ +public: + Test_TC_PCC_2_1() : TestCommand("Test_TC_PCC_2_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_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 : read the mandatory attribute: MaxPressure\n"); + err = TestReadTheMandatoryAttributeMaxPressure_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads back mandatory attribute: OnOff\n"); - err = TestReadsBackMandatoryAttributeOnOff_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: EffectiveOperationMode\n"); + err = TestReadTheMandatoryAttributeEffectiveOperationMode_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read LT attribute: GlobalSceneControl\n"); - err = TestReadLtAttributeGlobalSceneControl_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: EffectiveControlMode\n"); + err = TestReadTheMandatoryAttributeEffectiveControlMode_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read LT attribute: OnTime\n"); - err = TestReadLtAttributeOnTime_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read LT attribute: OffWaitTime\n"); - err = TestReadLtAttributeOffWaitTime_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read LT attribute: StartUpOnOff\n"); - err = TestReadLtAttributeStartUpOnOff_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : write the default value to LT attribute: OnTime\n"); - err = TestWriteTheDefaultValueToLtAttributeOnTime_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : write the default value to LT attribute: OffWaitTime\n"); - err = TestWriteTheDefaultValueToLtAttributeOffWaitTime_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : write the default value to LT attribute: StartUpOnOff\n"); - err = TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8(); + ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: Capacity\n"); + err = TestReadTheMandatoryAttributeCapacity_3(); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads back LT attribute: OnTime\n"); - err = TestReadsBackLtAttributeOnTime_9(); + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: MaxPressure\n"); + err = TestReadTheMandatoryAttributeMaxPressure_4(); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : reads back LT attribute: OffWaitTime\n"); - err = TestReadsBackLtAttributeOffWaitTime_10(); + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: EffectiveOperationMode\n"); + err = TestReadTheMandatoryAttributeEffectiveOperationMode_5(); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : reads back LT attribute: StartUpOnOff\n"); - err = TestReadsBackLtAttributeStartUpOnOff_11(); + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: EffectiveControlMode\n"); + err = TestReadTheMandatoryAttributeEffectiveControlMode_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: Capacity\n"); + err = TestReadTheMandatoryAttributeCapacity_7(); break; } @@ -13285,349 +16810,246 @@ class Test_TC_OO_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; + const uint16_t mTestCount = 8; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, + this }; chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, + this }; chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, + this }; chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, + this }; chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; - chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; - chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ OnSuccessCallback_10, this }; - chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; - chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context, bool onOff) + static void OnSuccessCallback_0(void * context, int16_t maxPressure) { - (static_cast(context))->OnSuccessResponse_0(onOff); + (static_cast(context))->OnSuccessResponse_0(maxPressure); } static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_1(void * context, bool onOff) + static void OnSuccessCallback_1(void * context, uint8_t effectiveOperationMode) { - (static_cast(context))->OnSuccessResponse_1(onOff); + (static_cast(context))->OnSuccessResponse_1(effectiveOperationMode); } static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_2(void * context, bool globalSceneControl) + static void OnSuccessCallback_2(void * context, uint8_t effectiveControlMode) { - (static_cast(context))->OnSuccessResponse_2(globalSceneControl); + (static_cast(context))->OnSuccessResponse_2(effectiveControlMode); } static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_3(void * context, uint16_t onTime) + static void OnSuccessCallback_3(void * context, int16_t capacity) { - (static_cast(context))->OnSuccessResponse_3(onTime); + (static_cast(context))->OnSuccessResponse_3(capacity); } static void OnFailureCallback_4(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_4(void * context, uint16_t offWaitTime) + static void OnSuccessCallback_4(void * context, int16_t maxPressure) { - (static_cast(context))->OnSuccessResponse_4(offWaitTime); + (static_cast(context))->OnSuccessResponse_4(maxPressure); } static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_5(status); } - static void OnSuccessCallback_5(void * context, uint8_t startUpOnOff) + static void OnSuccessCallback_5(void * context, uint8_t effectiveOperationMode) { - (static_cast(context))->OnSuccessResponse_5(startUpOnOff); + (static_cast(context))->OnSuccessResponse_5(effectiveOperationMode); } static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_6(status); } - static void OnSuccessCallback_6(void * context, uint16_t onTime) + static void OnSuccessCallback_6(void * context, uint8_t effectiveControlMode) { - (static_cast(context))->OnSuccessResponse_6(onTime); + (static_cast(context))->OnSuccessResponse_6(effectiveControlMode); } static void OnFailureCallback_7(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_7(status); - } - - static void OnSuccessCallback_7(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_7(offWaitTime); - } - - static void OnFailureCallback_8(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_8(status); - } - - static void OnSuccessCallback_8(void * context, uint8_t startUpOnOff) - { - (static_cast(context))->OnSuccessResponse_8(startUpOnOff); - } - - static void OnFailureCallback_9(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_9(status); - } - - static void OnSuccessCallback_9(void * context, uint16_t onTime) - { - (static_cast(context))->OnSuccessResponse_9(onTime); - } - - static void OnFailureCallback_10(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_10(status); - } - - static void OnSuccessCallback_10(void * context, uint16_t offWaitTime) - { - (static_cast(context))->OnSuccessResponse_10(offWaitTime); - } - - static void OnFailureCallback_11(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_11(status); + (static_cast(context))->OnFailureResponse_7(status); } - static void OnSuccessCallback_11(void * context, uint8_t startUpOnOff) + static void OnSuccessCallback_7(void * context, int16_t capacity) { - (static_cast(context))->OnSuccessResponse_11(startUpOnOff); + (static_cast(context))->OnSuccessResponse_7(capacity); } // // Tests methods // - CHIP_ERROR TestReadTheMandatoryAttributeOnOff_0() + CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_0() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeMaxPressure(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(bool onOff) + void OnSuccessResponse_0(int16_t maxPressure) { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); + VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); NextTest(); } - CHIP_ERROR TestReadsBackMandatoryAttributeOnOff_1() + CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_1() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeEffectiveOperationMode(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(bool onOff) + void OnSuccessResponse_1(uint8_t effectiveOperationMode) { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); + VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); NextTest(); } - CHIP_ERROR TestReadLtAttributeGlobalSceneControl_2() + CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_2() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttributeEffectiveControlMode(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(bool globalSceneControl) + void OnSuccessResponse_2(uint8_t effectiveControlMode) { - VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); + VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); NextTest(); } - CHIP_ERROR TestReadLtAttributeOnTime_3() + CHIP_ERROR TestReadTheMandatoryAttributeCapacity_3() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnTime(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeCapacity(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint16_t onTime) + void OnSuccessResponse_3(int16_t capacity) { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); NextTest(); } - CHIP_ERROR TestReadLtAttributeOffWaitTime_4() + CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_4() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + return cluster.ReadAttributeMaxPressure(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); } void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint16_t offWaitTime) + void OnSuccessResponse_4(int16_t maxPressure) { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); NextTest(); } - CHIP_ERROR TestReadLtAttributeStartUpOnOff_5() + CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_5() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeEffectiveOperationMode(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint8_t startUpOnOff) - { - VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); - NextTest(); - } - - CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOnTime_6() - { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - uint16_t onTimeArgument = 0U; - - return cluster.WriteAttributeOnTime(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel(), onTimeArgument); - } - - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_6(uint16_t onTime) { NextTest(); } - - CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOffWaitTime_7() - { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - uint16_t offWaitTimeArgument = 0U; - - return cluster.WriteAttributeOffWaitTime(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel(), offWaitTimeArgument); - } - - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_7(uint16_t offWaitTime) { NextTest(); } - - CHIP_ERROR TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8() - { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - uint8_t startUpOnOffArgument = static_cast(0); - - return cluster.WriteAttributeStartUpOnOff(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel(), - startUpOnOffArgument); - } - - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_8(uint8_t startUpOnOff) { NextTest(); } - - CHIP_ERROR TestReadsBackLtAttributeOnTime_9() - { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeOnTime(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); - } - - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_9(uint16_t onTime) + void OnSuccessResponse_5(uint8_t effectiveOperationMode) { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); NextTest(); } - CHIP_ERROR TestReadsBackLtAttributeOffWaitTime_10() + CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_6() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeEffectiveControlMode(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint16_t offWaitTime) + void OnSuccessResponse_6(uint8_t effectiveControlMode) { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); NextTest(); } - CHIP_ERROR TestReadsBackLtAttributeStartUpOnOff_11() + CHIP_ERROR TestReadTheMandatoryAttributeCapacity_7() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + return cluster.ReadAttributeCapacity(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11(uint8_t startUpOnOff) + void OnSuccessResponse_7(int16_t capacity) { - VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); NextTest(); } }; -class Test_TC_OO_2_2 : public TestCommand +class Test_TC_PCC_2_2 : public TestCommand { public: - Test_TC_OO_2_2() : TestCommand("Test_TC_OO_2_2"), mTestIndex(0) {} + Test_TC_PCC_2_2() : TestCommand("Test_TC_PCC_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -13636,12 +17058,12 @@ class Test_TC_OO_2_2 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -13655,60 +17077,16 @@ class Test_TC_OO_2_2 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Send Off Command\n"); - err = TestSendOffCommand_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Write 1 to the OperationMode attribute to DUT: OperationMode\n"); + err = TestWrite1ToTheOperationModeAttributeToDutOperationMode_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Write 2 to the OperationMode attribute to DUT: OperationMode\n"); + err = TestWrite2ToTheOperationModeAttributeToDutOperationMode_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Send On Command\n"); - err = TestSendOnCommand_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Send Off Command\n"); - err = TestSendOffCommand_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Send Toggle Command\n"); - err = TestSendToggleCommand_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Check on/off attribute value is true after toggle command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Send Toggle Command\n"); - err = TestSendToggleCommand_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Check on/off attribute value is false after toggle command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Send On Command\n"); - err = TestSendOnCommand_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Check on/off attribute value is true after on command\n"); - err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Send Off Command\n"); - err = TestSendOffCommand_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Check on/off attribute value is false after off command\n"); - err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Write 3 to the OperationMode attribute to DUT: OperationMode\n"); + err = TestWrite3ToTheOperationModeAttributeToDutOperationMode_2(); break; } @@ -13721,382 +17099,293 @@ class Test_TC_OO_2_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + const uint16_t mTestCount = 3; + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; - chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; - chip::Callback::Callback mOnSuccessCallback_11{ OnSuccessCallback_11, this }; - chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; - chip::Callback::Callback mOnSuccessCallback_13{ OnSuccessCallback_13, this }; - - static void OnFailureCallback_1(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_1(status); - } - - static void OnSuccessCallback_1(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_1(onOff); - } - - static void OnFailureCallback_3(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_3(status); - } - - static void OnSuccessCallback_3(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_3(onOff); - } - - static void OnFailureCallback_5(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_5(status); - } - - static void OnSuccessCallback_5(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_5(onOff); - } - - static void OnFailureCallback_7(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_7(status); - } - - static void OnSuccessCallback_7(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_7(onOff); - } - - static void OnFailureCallback_9(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_9(status); - } - - static void OnSuccessCallback_9(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_9(onOff); - } - - static void OnFailureCallback_11(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_11(status); - } - - static void OnSuccessCallback_11(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_11(onOff); - } - - static void OnFailureCallback_13(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_13(status); - } - - static void OnSuccessCallback_13(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_13(onOff); - } - - // - // Tests methods - // - - CHIP_ERROR TestSendOffCommand_0() - { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::Off::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } - - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0() { NextTest(); } + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1() + static void OnFailureCallback_0(void * context, uint8_t status) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + (static_cast(context))->OnFailureResponse_0(status); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1(bool onOff) + static void OnSuccessCallback_0(void * context, uint8_t operationMode) { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - NextTest(); + (static_cast(context))->OnSuccessResponse_0(operationMode); } - CHIP_ERROR TestSendOnCommand_2() + static void OnFailureCallback_1(void * context, uint8_t status) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::OnOff::Commands::On::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::On::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + (static_cast(context))->OnFailureResponse_1(status); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3() + static void OnSuccessCallback_1(void * context, uint8_t operationMode) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeOnOff(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + (static_cast(context))->OnSuccessResponse_1(operationMode); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_3(bool onOff) + static void OnFailureCallback_2(void * context, uint8_t status) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - NextTest(); + (static_cast(context))->OnFailureResponse_2(status); } - CHIP_ERROR TestSendOffCommand_4() + static void OnSuccessCallback_2(void * context, uint8_t operationMode) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::Off::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + (static_cast(context))->OnSuccessResponse_2(operationMode); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_4() { NextTest(); } + // + // Tests methods + // - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() + CHIP_ERROR TestWrite1ToTheOperationModeAttributeToDutOperationMode_0() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + uint8_t operationModeArgument = static_cast(1); + + return cluster.WriteAttributeOperationMode(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), + operationModeArgument); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - NextTest(); - } + void OnSuccessResponse_0(uint8_t operationMode) { NextTest(); } - CHIP_ERROR TestSendToggleCommand_6() + CHIP_ERROR TestWrite2ToTheOperationModeAttributeToDutOperationMode_1() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; - using responseType = chip::app::DataModel::NullObjectType; - - chip::app::Clusters::OnOff::Commands::Toggle::Type request; - - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; + uint8_t operationModeArgument = static_cast(2); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.WriteAttributeOperationMode(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), + operationModeArgument); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_1(uint8_t operationMode) { NextTest(); } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7() + CHIP_ERROR TestWrite3ToTheOperationModeAttributeToDutOperationMode_2() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + uint8_t operationModeArgument = static_cast(3); + + return cluster.WriteAttributeOperationMode(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), + operationModeArgument); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); - NextTest(); - } + void OnSuccessResponse_2(uint8_t operationMode) { NextTest(); } +}; - CHIP_ERROR TestSendToggleCommand_8() +class Test_TC_PCC_2_3 : public TestCommand +{ +public: + Test_TC_PCC_2_3() : TestCommand("Test_TC_PCC_2_3"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + CHIP_ERROR err = CHIP_NO_ERROR; - using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; - using responseType = chip::app::DataModel::NullObjectType; + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_3\n"); + } - chip::app::Clusters::OnOff::Commands::Toggle::Type request; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_3\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; + Wait(); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_8(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + // 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 : Write 0 to the OperationMode attribute to DUT\n"); + err = TestWrite0ToTheOperationModeAttributeToDut_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the attribute: EffectiveOperationMode\n"); + err = TestReadsTheAttributeEffectiveOperationMode_1(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 2; - void OnSuccessResponse_8() { NextTest(); } + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, + this }; - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9() + static void OnFailureCallback_0(void * context, uint8_t status) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeOnOff(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + (static_cast(context))->OnFailureResponse_0(status); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_0(void * context, uint8_t operationMode) + { + (static_cast(context))->OnSuccessResponse_0(operationMode); + } - void OnSuccessResponse_9(bool onOff) + static void OnFailureCallback_1(void * context, uint8_t status) { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - NextTest(); + (static_cast(context))->OnFailureResponse_1(status); } - CHIP_ERROR TestSendOnCommand_10() + static void OnSuccessCallback_1(void * context, uint8_t effectiveOperationMode) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_1(effectiveOperationMode); + } - using requestType = chip::app::Clusters::OnOff::Commands::On::Type; - using responseType = chip::app::DataModel::NullObjectType; + // + // Tests methods + // - chip::app::Clusters::OnOff::Commands::On::Type request; + CHIP_ERROR TestWrite0ToTheOperationModeAttributeToDut_0() + { + chip::Controller::PumpConfigurationAndControlClusterTest cluster; + cluster.Associate(mDevice, 1); - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; + uint8_t operationModeArgument = static_cast(0); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_10(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.WriteAttributeOperationMode(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), + operationModeArgument); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10() { NextTest(); } + void OnSuccessResponse_0(uint8_t operationMode) { NextTest(); } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11() + CHIP_ERROR TestReadsTheAttributeEffectiveOperationMode_1() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + return cluster.ReadAttributeEffectiveOperationMode(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11(bool onOff) + void OnSuccessResponse_1(uint8_t effectiveOperationMode) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + VerifyOrReturn(CheckValue("effectiveOperationMode", effectiveOperationMode, 0)); NextTest(); } +}; - CHIP_ERROR TestSendOffCommand_12() +class Test_TC_RH_1_1 : public TestCommand +{ +public: + Test_TC_RH_1_1() : TestCommand("Test_TC_RH_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + CHIP_ERROR err = CHIP_NO_ERROR; - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; - using responseType = chip::app::DataModel::NullObjectType; + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_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 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } - chip::app::Clusters::OnOff::Commands::Off::Type request; +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_12(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); } - void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_0(clusterRevision); + } - void OnSuccessResponse_12() { NextTest(); } + // + // Tests methods + // - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + uint16_t clusterRevisionArgument = 1U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), + clusterRevisionArgument); } - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { NextTest(); } - void OnSuccessResponse_13(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - NextTest(); - } + void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } }; -class Test_TC_PCC_1_1 : public TestCommand +class Test_TC_RH_2_1 : public TestCommand { public: - Test_TC_PCC_1_1() : TestCommand("Test_TC_PCC_1_1"), mTestIndex(0) {} + Test_TC_RH_2_1() : TestCommand("Test_TC_RH_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14105,12 +17394,12 @@ class Test_TC_PCC_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14124,9 +17413,12 @@ class Test_TC_PCC_1_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, - " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Reads constraints of attribute: MeasuredValue\n"); + err = TestReadsConstraintsOfAttributeMeasuredValue_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MinMeasuredValue\n"); + err = TestReadsConstraintsOfAttributeMinMeasuredValue_1(); break; } @@ -14139,45 +17431,75 @@ class Test_TC_PCC_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 2; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_0(void * context, uint16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_0(measuredValue); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint16_t minMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); } // // Tests methods // - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + CHIP_ERROR TestReadsConstraintsOfAttributeMeasuredValue_0() { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument = 3U; + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), - clusterRevisionArgument); + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } + CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_1() + { + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } + return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint16_t minMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 9999)); + NextTest(); + } }; -class Test_TC_PCC_2_1 : public TestCommand +class Test_TC_RH_2_2 : public TestCommand { public: - Test_TC_PCC_2_1() : TestCommand("Test_TC_PCC_2_1"), mTestIndex(0) {} + Test_TC_RH_2_2() : TestCommand("Test_TC_RH_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14186,12 +17508,12 @@ class Test_TC_PCC_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14205,36 +17527,12 @@ class Test_TC_PCC_2_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: MaxPressure\n"); - err = TestReadTheMandatoryAttributeMaxPressure_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Reads MeasuredValue attribute from DUT\n"); + err = TestReadsMeasuredValueAttributeFromDut_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: EffectiveOperationMode\n"); - err = TestReadTheMandatoryAttributeEffectiveOperationMode_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: EffectiveControlMode\n"); - err = TestReadTheMandatoryAttributeEffectiveControlMode_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: Capacity\n"); - err = TestReadTheMandatoryAttributeCapacity_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: MaxPressure\n"); - err = TestReadTheMandatoryAttributeMaxPressure_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: EffectiveOperationMode\n"); - err = TestReadTheMandatoryAttributeEffectiveOperationMode_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: EffectiveControlMode\n"); - err = TestReadTheMandatoryAttributeEffectiveControlMode_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: Capacity\n"); - err = TestReadTheMandatoryAttributeCapacity_7(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_1(); break; } @@ -14247,246 +17545,300 @@ class Test_TC_PCC_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 2; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, - this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, - this }; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; - chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, - this }; - chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; - chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, - this }; - chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; - chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context, int16_t maxPressure) + static void OnSuccessCallback_0(void * context, uint16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_0(maxPressure); + (static_cast(context))->OnSuccessResponse_0(measuredValue); } static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_1(void * context, uint8_t effectiveOperationMode) + static void OnSuccessCallback_1(void * context, uint16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_1(effectiveOperationMode); + (static_cast(context))->OnSuccessResponse_1(measuredValue); } - static void OnFailureCallback_2(void * context, uint8_t status) + // + // Tests methods + // + + CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_0() { - (static_cast(context))->OnFailureResponse_2(status); + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - static void OnSuccessCallback_2(void * context, uint8_t effectiveControlMode) + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_2(effectiveControlMode); + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); } - static void OnFailureCallback_3(void * context, uint8_t status) + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() { - (static_cast(context))->OnFailureResponse_3(status); + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - static void OnSuccessCallback_3(void * context, int16_t capacity) + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_3(capacity); + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); } +}; - static void OnFailureCallback_4(void * context, uint8_t status) +class Test_TC_TM_1_1 : public TestCommand +{ +public: + Test_TC_TM_1_1() : TestCommand("Test_TC_TM_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override { - (static_cast(context))->OnFailureResponse_4(status); + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_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 : read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_2(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - static void OnSuccessCallback_4(void * context, int16_t maxPressure) - { - (static_cast(context))->OnSuccessResponse_4(maxPressure); - } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; - static void OnFailureCallback_5(void * context, uint8_t status) + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_5(void * context, uint8_t effectiveOperationMode) + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_5(effectiveOperationMode); + (static_cast(context))->OnSuccessResponse_0(clusterRevision); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_6(void * context, uint8_t effectiveControlMode) + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_6(effectiveControlMode); + (static_cast(context))->OnSuccessResponse_1(clusterRevision); } - static void OnFailureCallback_7(void * context, uint8_t status) + static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_7(void * context, int16_t capacity) + static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_7(capacity); + (static_cast(context))->OnSuccessResponse_2(clusterRevision); } // // Tests methods // - CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_0() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; + chip::Controller::TemperatureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxPressure(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(int16_t maxPressure) + void OnSuccessResponse_0(uint16_t clusterRevision) { - VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_1() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; + chip::Controller::TemperatureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeEffectiveOperationMode(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + uint16_t clusterRevisionArgument = 3U; + + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), + clusterRevisionArgument); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { NextTest(); } - void OnSuccessResponse_1(uint8_t effectiveOperationMode) - { - VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); - NextTest(); - } + void OnSuccessResponse_1(uint16_t clusterRevision) { ThrowSuccessResponse(); } - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_2() + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; + chip::Controller::TemperatureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeEffectiveControlMode(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t effectiveControlMode) + void OnSuccessResponse_2(uint16_t clusterRevision) { - VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); NextTest(); } +}; - CHIP_ERROR TestReadTheMandatoryAttributeCapacity_3() - { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCapacity(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); - } - - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_3(int16_t capacity) - { - VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); - NextTest(); - } +class Test_TC_TM_2_1 : public TestCommand +{ +public: + Test_TC_TM_2_1() : TestCommand("Test_TC_TM_2_1"), mTestIndex(0) {} - CHIP_ERROR TestReadTheMandatoryAttributeMaxPressure_4() + /////////// TestCommand Interface ///////// + void NextTest() override { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevice, 1); + CHIP_ERROR err = CHIP_NO_ERROR; - return cluster.ReadAttributeMaxPressure(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); - } + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_2_1\n"); + } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - void OnSuccessResponse_4(int16_t maxPressure) - { - VerifyOrReturn(CheckConstraintType("maxPressure", "", "int16")); - NextTest(); - } + Wait(); - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveOperationMode_5() - { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevice, 1); + // 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 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_0(); + break; + } - return cluster.ReadAttributeEffectiveOperationMode(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - void OnSuccessResponse_5(uint8_t effectiveOperationMode) - { - VerifyOrReturn(CheckConstraintType("effectiveOperationMode", "", "enum8")); - NextTest(); - } + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - CHIP_ERROR TestReadTheMandatoryAttributeEffectiveControlMode_6() + static void OnFailureCallback_0(void * context, uint8_t status) { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeEffectiveControlMode(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + (static_cast(context))->OnFailureResponse_0(status); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_6(uint8_t effectiveControlMode) + static void OnSuccessCallback_0(void * context, int16_t measuredValue) { - VerifyOrReturn(CheckConstraintType("effectiveControlMode", "", "enum8")); - NextTest(); + (static_cast(context))->OnSuccessResponse_0(measuredValue); } - CHIP_ERROR TestReadTheMandatoryAttributeCapacity_7() + // + // Tests methods + // + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; + chip::Controller::TemperatureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCapacity(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(int16_t capacity) + void OnSuccessResponse_0(int16_t measuredValue) { - VerifyOrReturn(CheckConstraintType("capacity", "", "int16")); + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); NextTest(); } }; -class Test_TC_PCC_2_2 : public TestCommand +class Test_TC_TM_2_2 : public TestCommand { public: - Test_TC_PCC_2_2() : TestCommand("Test_TC_PCC_2_2"), mTestIndex(0) {} + Test_TC_TM_2_2() : TestCommand("Test_TC_TM_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14495,12 +17847,12 @@ class Test_TC_PCC_2_2 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14514,16 +17866,12 @@ class Test_TC_PCC_2_2 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Write 1 to the OperationMode attribute to DUT: OperationMode\n"); - err = TestWrite1ToTheOperationModeAttributeToDutOperationMode_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Reads MeasuredValue attribute from DUT\n"); + err = TestReadsMeasuredValueAttributeFromDut_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Write 2 to the OperationMode attribute to DUT: OperationMode\n"); - err = TestWrite2ToTheOperationModeAttributeToDutOperationMode_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Write 3 to the OperationMode attribute to DUT: OperationMode\n"); - err = TestWrite3ToTheOperationModeAttributeToDutOperationMode_2(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_1(); break; } @@ -14536,99 +17884,74 @@ class Test_TC_PCC_2_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 2; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_0(void * context, uint8_t operationMode) + static void OnSuccessCallback_0(void * context, int16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_0(operationMode); + (static_cast(context))->OnSuccessResponse_0(measuredValue); } static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); - } - - static void OnSuccessCallback_1(void * context, uint8_t operationMode) - { - (static_cast(context))->OnSuccessResponse_1(operationMode); - } - - static void OnFailureCallback_2(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_2(void * context, uint8_t operationMode) + static void OnSuccessCallback_1(void * context, int16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_2(operationMode); + (static_cast(context))->OnSuccessResponse_1(measuredValue); } // // Tests methods // - CHIP_ERROR TestWrite1ToTheOperationModeAttributeToDutOperationMode_0() + CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_0() { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; + chip::Controller::TemperatureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t operationModeArgument = static_cast(1); - - return cluster.WriteAttributeOperationMode(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), - operationModeArgument); + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint8_t operationMode) { NextTest(); } - - CHIP_ERROR TestWrite2ToTheOperationModeAttributeToDutOperationMode_1() + void OnSuccessResponse_0(int16_t measuredValue) { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - uint8_t operationModeArgument = static_cast(2); - - return cluster.WriteAttributeOperationMode(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), - operationModeArgument); + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1(uint8_t operationMode) { NextTest(); } - - CHIP_ERROR TestWrite3ToTheOperationModeAttributeToDutOperationMode_2() + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; + chip::Controller::TemperatureMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t operationModeArgument = static_cast(3); - - return cluster.WriteAttributeOperationMode(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), - operationModeArgument); + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t operationMode) { NextTest(); } + void OnSuccessResponse_1(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } }; -class Test_TC_PCC_2_3 : public TestCommand +class Test_TC_TSTAT_1_1 : public TestCommand { public: - Test_TC_PCC_2_3() : TestCommand("Test_TC_PCC_2_3"), mTestIndex(0) {} + Test_TC_TSTAT_1_1() : TestCommand("Test_TC_TSTAT_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14637,12 +17960,12 @@ class Test_TC_PCC_2_3 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_PCC_2_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_PCC_2_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14656,12 +17979,9 @@ class Test_TC_PCC_2_3 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Write 0 to the OperationMode attribute to DUT\n"); - err = TestWrite0ToTheOperationModeAttributeToDut_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the attribute: EffectiveOperationMode\n"); - err = TestReadsTheAttributeEffectiveOperationMode_1(); + ChipLogProgress(chipTool, + " ***** Test Step 0 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); break; } @@ -14674,74 +17994,45 @@ class Test_TC_PCC_2_3 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 1; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, - this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); - } - - static void OnSuccessCallback_0(void * context, uint8_t operationMode) - { - (static_cast(context))->OnSuccessResponse_0(operationMode); - } - - static void OnFailureCallback_1(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_1(void * context, uint8_t effectiveOperationMode) + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_1(effectiveOperationMode); + (static_cast(context))->OnSuccessResponse_0(clusterRevision); } // // Tests methods // - CHIP_ERROR TestWrite0ToTheOperationModeAttributeToDut_0() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; + chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t operationModeArgument = static_cast(0); - - return cluster.WriteAttributeOperationMode(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), - operationModeArgument); - } - - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint8_t operationMode) { NextTest(); } - - CHIP_ERROR TestReadsTheAttributeEffectiveOperationMode_1() - { - chip::Controller::PumpConfigurationAndControlClusterTest cluster; - cluster.Associate(mDevice, 1); + uint16_t clusterRevisionArgument = 5U; - return cluster.ReadAttributeEffectiveOperationMode(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), + clusterRevisionArgument); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { NextTest(); } - void OnSuccessResponse_1(uint8_t effectiveOperationMode) - { - VerifyOrReturn(CheckValue("effectiveOperationMode", effectiveOperationMode, 0)); - NextTest(); - } + void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } }; -class Test_TC_RH_1_1 : public TestCommand +class Test_TC_TSUIC_1_1 : public TestCommand { public: - Test_TC_RH_1_1() : TestCommand("Test_TC_RH_1_1"), mTestIndex(0) {} + Test_TC_TSUIC_1_1() : TestCommand("Test_TC_TSUIC_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14750,12 +18041,12 @@ class Test_TC_RH_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14791,12 +18082,12 @@ class Test_TC_RH_1_1 : public TestCommand static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_0(clusterRevision); } // @@ -14805,10 +18096,10 @@ class Test_TC_RH_1_1 : public TestCommand CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() { - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument = 1U; + uint16_t clusterRevisionArgument = 2U; return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), clusterRevisionArgument); @@ -14819,10 +18110,10 @@ class Test_TC_RH_1_1 : public TestCommand void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } }; -class Test_TC_RH_2_1 : public TestCommand +class Test_TC_TSUIC_2_1 : public TestCommand { public: - Test_TC_RH_2_1() : TestCommand("Test_TC_RH_2_1"), mTestIndex(0) {} + Test_TC_TSUIC_2_1() : TestCommand("Test_TC_TSUIC_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14831,12 +18122,12 @@ class Test_TC_RH_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_RH_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_RH_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14850,12 +18141,64 @@ class Test_TC_RH_2_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reads constraints of attribute: MeasuredValue\n"); - err = TestReadsConstraintsOfAttributeMeasuredValue_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: TemperatureDisplayMode\n"); + err = TestReadTheMandatoryAttributeTemperatureDisplayMode_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MinMeasuredValue\n"); - err = TestReadsConstraintsOfAttributeMinMeasuredValue_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: TemperatureDisplayMode\n"); + err = TestReadTheMandatoryAttributeTemperatureDisplayMode_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : write to the mandatory attribute: TemperatureDisplayMode\n"); + err = TestWriteToTheMandatoryAttributeTemperatureDisplayMode_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: TemperatureDisplayMode\n"); + err = TestReadTheMandatoryAttributeTemperatureDisplayMode_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: TemperatureDisplayMode\n"); + err = TestReadTheMandatoryAttributeTemperatureDisplayMode_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : write to the mandatory attribute: KeypadLockout\n"); + err = TestWriteToTheMandatoryAttributeKeypadLockout_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : write to the mandatory attribute: ScheduleProgrammingVisibility\n"); + err = TestWriteToTheMandatoryAttributeScheduleProgrammingVisibility_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_14(); break; } @@ -14868,463 +18211,450 @@ class Test_TC_RH_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 15; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, + this }; chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, + this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, + this }; + chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, + this }; + chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, + this }; + chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; + chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; + chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; + chip::Callback::Callback mOnSuccessCallback_6{ OnSuccessCallback_6, this }; + chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; + chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; + chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; + chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; + chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; + chip::Callback::Callback mOnSuccessCallback_10{ + OnSuccessCallback_10, this + }; + chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; + chip::Callback::Callback mOnSuccessCallback_11{ + OnSuccessCallback_11, this + }; + chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; + chip::Callback::Callback mOnSuccessCallback_12{ + OnSuccessCallback_12, this + }; + chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; + chip::Callback::Callback mOnSuccessCallback_13{ + OnSuccessCallback_13, this + }; + chip::Callback::Callback mOnFailureCallback_14{ OnFailureCallback_14, this }; + chip::Callback::Callback mOnSuccessCallback_14{ + OnSuccessCallback_14, this + }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint8_t temperatureDisplayMode) + { + (static_cast(context))->OnSuccessResponse_0(temperatureDisplayMode); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t temperatureDisplayMode) + { + (static_cast(context))->OnSuccessResponse_1(temperatureDisplayMode); + } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint8_t temperatureDisplayMode) + { + (static_cast(context))->OnSuccessResponse_2(temperatureDisplayMode); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint8_t temperatureDisplayMode) + { + (static_cast(context))->OnSuccessResponse_3(temperatureDisplayMode); + } + + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint8_t temperatureDisplayMode) + { + (static_cast(context))->OnSuccessResponse_4(temperatureDisplayMode); } - static void OnSuccessCallback_0(void * context, uint16_t measuredValue) + static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_0(measuredValue); + (static_cast(context))->OnFailureResponse_5(status); } - static void OnFailureCallback_1(void * context, uint8_t status) + static void OnSuccessCallback_5(void * context, uint8_t keypadLockout) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnSuccessResponse_5(keypadLockout); } - static void OnSuccessCallback_1(void * context, uint16_t minMeasuredValue) + static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); + (static_cast(context))->OnFailureResponse_6(status); } - // - // Tests methods - // - - CHIP_ERROR TestReadsConstraintsOfAttributeMeasuredValue_0() + static void OnSuccessCallback_6(void * context, uint8_t keypadLockout) { - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + (static_cast(context))->OnSuccessResponse_6(keypadLockout); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint16_t measuredValue) + static void OnFailureCallback_7(void * context, uint8_t status) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); + (static_cast(context))->OnFailureResponse_7(status); } - CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_1() + static void OnSuccessCallback_7(void * context, uint8_t keypadLockout) { - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + (static_cast(context))->OnSuccessResponse_7(keypadLockout); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1(uint16_t minMeasuredValue) + static void OnFailureCallback_8(void * context, uint8_t status) { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); - VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 9999)); - NextTest(); + (static_cast(context))->OnFailureResponse_8(status); } -}; - -class Test_TC_TM_1_1 : public TestCommand -{ -public: - Test_TC_TM_1_1() : TestCommand("Test_TC_TM_1_1"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnSuccessCallback_8(void * context, uint8_t keypadLockout) { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_1_1\n"); - } + (static_cast(context))->OnSuccessResponse_8(keypadLockout); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnFailureCallback_9(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_9(status); + } - Wait(); + static void OnSuccessCallback_9(void * context, uint8_t keypadLockout) + { + (static_cast(context))->OnSuccessResponse_9(keypadLockout); + } - // 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 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_0(); - break; - case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_2(); - break; - } + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(status); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnSuccessCallback_10(void * context, uint8_t scheduleProgrammingVisibility) + { + (static_cast(context))->OnSuccessResponse_10(scheduleProgrammingVisibility); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + static void OnFailureCallback_11(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_11(status); + } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; - chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; - chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; - chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; + static void OnSuccessCallback_11(void * context, uint8_t scheduleProgrammingVisibility) + { + (static_cast(context))->OnSuccessResponse_11(scheduleProgrammingVisibility); + } - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_12(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_12(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_12(void * context, uint8_t scheduleProgrammingVisibility) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_12(scheduleProgrammingVisibility); } - static void OnFailureCallback_1(void * context, uint8_t status) + static void OnFailureCallback_13(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_13(status); } - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_13(void * context, uint8_t scheduleProgrammingVisibility) { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); + (static_cast(context))->OnSuccessResponse_13(scheduleProgrammingVisibility); } - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_14(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_14(status); } - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_14(void * context, uint8_t scheduleProgrammingVisibility) { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + (static_cast(context))->OnSuccessResponse_14(scheduleProgrammingVisibility); } // // Tests methods // - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_0() { - chip::Controller::TemperatureMeasurementClusterTest cluster; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeTemperatureDisplayMode(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint16_t clusterRevision) + void OnSuccessResponse_0(uint8_t temperatureDisplayMode) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); + VerifyOrReturn(CheckValue("temperatureDisplayMode", temperatureDisplayMode, 0)); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_1() { - chip::Controller::TemperatureMeasurementClusterTest cluster; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument = 3U; - - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), - clusterRevisionArgument); + return cluster.ReadAttributeTemperatureDisplayMode(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(uint16_t clusterRevision) { ThrowSuccessResponse(); } + void OnSuccessResponse_1(uint8_t temperatureDisplayMode) + { + VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); + NextTest(); + } - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + CHIP_ERROR TestWriteToTheMandatoryAttributeTemperatureDisplayMode_2() { - chip::Controller::TemperatureMeasurementClusterTest cluster; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + uint8_t temperatureDisplayModeArgument = static_cast(0); + + return cluster.WriteAttributeTemperatureDisplayMode(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), + temperatureDisplayModeArgument); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint16_t clusterRevision) - { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); - NextTest(); - } -}; - -class Test_TC_TM_2_1 : public TestCommand -{ -public: - Test_TC_TM_2_1() : TestCommand("Test_TC_TM_2_1"), mTestIndex(0) {} + void OnSuccessResponse_2(uint8_t temperatureDisplayMode) { NextTest(); } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_3() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TM_2_1\n"); - } + return cluster.ReadAttributeTemperatureDisplayMode(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TM_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_3(uint8_t temperatureDisplayMode) + { + VerifyOrReturn(CheckValue("temperatureDisplayMode", temperatureDisplayMode, 0)); + NextTest(); + } - // 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 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_0(); - break; - } + CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_4() + { + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeTemperatureDisplayMode(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; - - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_0(void * context, uint8_t status) + void OnSuccessResponse_4(uint8_t temperatureDisplayMode) { - (static_cast(context))->OnFailureResponse_0(status); + VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); + NextTest(); } - static void OnSuccessCallback_0(void * context, int16_t measuredValue) + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_5() { - (static_cast(context))->OnSuccessResponse_0(measuredValue); + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeKeypadLockout(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } - // - // Tests methods - // + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() + void OnSuccessResponse_5(uint8_t keypadLockout) { - chip::Controller::TemperatureMeasurementClusterTest cluster; + VerifyOrReturn(CheckValue("keypadLockout", keypadLockout, 0)); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_6() + { + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeKeypadLockout(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(int16_t measuredValue) + void OnSuccessResponse_6(uint8_t keypadLockout) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); + VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); NextTest(); } -}; - -class Test_TC_TSTAT_1_1 : public TestCommand -{ -public: - Test_TC_TSTAT_1_1() : TestCommand("Test_TC_TSTAT_1_1"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestWriteToTheMandatoryAttributeKeypadLockout_7() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSTAT_1_1\n"); - } + uint8_t keypadLockoutArgument = static_cast(0); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSTAT_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + return cluster.WriteAttributeKeypadLockout(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel(), + keypadLockoutArgument); + } - Wait(); + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - // 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 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); - break; - } + void OnSuccessResponse_7(uint8_t keypadLockout) { NextTest(); } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_8() + { + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + return cluster.ReadAttributeKeypadLockout(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_0(void * context, uint8_t status) + void OnSuccessResponse_8(uint8_t keypadLockout) { - (static_cast(context))->OnFailureResponse_0(status); + VerifyOrReturn(CheckValue("keypadLockout", keypadLockout, 0)); + NextTest(); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_9() { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeKeypadLockout(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } - // - // Tests methods - // + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + void OnSuccessResponse_9(uint8_t keypadLockout) { - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevice, 1); + VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); + NextTest(); + } - uint16_t clusterRevisionArgument = 5U; + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_10() + { + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), - clusterRevisionArgument); + return cluster.ReadAttributeScheduleProgrammingVisibility(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } - - void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } -}; + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } -class Test_TC_TSUIC_1_1 : public TestCommand -{ -public: - Test_TC_TSUIC_1_1() : TestCommand("Test_TC_TSUIC_1_1"), mTestIndex(0) {} + void OnSuccessResponse_10(uint8_t scheduleProgrammingVisibility) + { + VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 0)); + NextTest(); + } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_11() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_1_1\n"); - } + return cluster.ReadAttributeScheduleProgrammingVisibility(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_11(uint8_t scheduleProgrammingVisibility) + { + VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); + NextTest(); + } - // 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 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); - break; - } + CHIP_ERROR TestWriteToTheMandatoryAttributeScheduleProgrammingVisibility_12() + { + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + uint8_t scheduleProgrammingVisibilityArgument = static_cast(0); + + return cluster.WriteAttributeScheduleProgrammingVisibility(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel(), + scheduleProgrammingVisibilityArgument); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + void OnSuccessResponse_12(uint8_t scheduleProgrammingVisibility) { NextTest(); } - static void OnFailureCallback_0(void * context, uint8_t status) + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_13() { - (static_cast(context))->OnFailureResponse_0(status); + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeScheduleProgrammingVisibility(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13(uint8_t scheduleProgrammingVisibility) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 0)); + NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_14() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument = 2U; - - return cluster.WriteAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), - clusterRevisionArgument); + return cluster.ReadAttributeScheduleProgrammingVisibility(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel()); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } + void OnFailureResponse_14(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint16_t clusterRevision) { ThrowSuccessResponse(); } + void OnSuccessResponse_14(uint8_t scheduleProgrammingVisibility) + { + VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); + NextTest(); + } }; -class Test_TC_TSUIC_2_1 : public TestCommand +class Test_TC_TSUIC_2_2 : public TestCommand { public: - Test_TC_TSUIC_2_1() : TestCommand("Test_TC_TSUIC_2_1"), mTestIndex(0) {} + Test_TC_TSUIC_2_2() : TestCommand("Test_TC_TSUIC_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -15333,12 +18663,12 @@ class Test_TC_TSUIC_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TSUIC_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TSUIC_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -15352,64 +18682,46 @@ class Test_TC_TSUIC_2_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Writes a value of 0 to TemperatureDisplayMode attribute of DUT\n"); + err = TestWritesAValueOf0ToTemperatureDisplayModeAttributeOfDut_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Writes a value of 1 to TemperatureDisplayMode attribute of DUT\n"); + err = TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : write to the mandatory attribute: TemperatureDisplayMode\n"); - err = TestWriteToTheMandatoryAttributeTemperatureDisplayMode_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : write to the mandatory attribute: KeypadLockout\n"); - err = TestWriteToTheMandatoryAttributeKeypadLockout_7(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Writes a value of 0 to KeypadLockout attribute of DUT\n"); + err = TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_2(); break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_8(); + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Writes a value of 1 to KeypadLockout attribute of DUT\n"); + err = TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_3(); break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_9(); + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Writes a value of 2 to KeypadLockout attribute of DUT\n"); + err = TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_4(); break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_10(); + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Writes a value of 3 to KeypadLockout attribute of DUT\n"); + err = TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_5(); break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_11(); + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Writes a value of 4 to KeypadLockout attribute of DUT\n"); + err = TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_6(); break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : write to the mandatory attribute: ScheduleProgrammingVisibility\n"); - err = TestWriteToTheMandatoryAttributeScheduleProgrammingVisibility_12(); + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Writes a value of 5 to KeypadLockout attribute of DUT\n"); + err = TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_7(); break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_13(); + case 8: + ChipLogProgress(chipTool, + " ***** Test Step 8 : Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT\n"); + err = TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_8(); break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_14(); + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT\n"); + err = TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_9(); break; } @@ -15422,7 +18734,7 @@ class Test_TC_TSUIC_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 15; + const uint16_t mTestCount = 10; chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, @@ -15431,14 +18743,11 @@ class Test_TC_TSUIC_2_1 : public TestCommand chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, - this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, - this }; + chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; chip::Callback::Callback mOnFailureCallback_4{ OnFailureCallback_4, this }; - chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, - this }; + chip::Callback::Callback mOnSuccessCallback_4{ OnSuccessCallback_4, this }; chip::Callback::Callback mOnFailureCallback_5{ OnFailureCallback_5, this }; chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, this }; chip::Callback::Callback mOnFailureCallback_6{ OnFailureCallback_6, this }; @@ -15446,420 +18755,267 @@ class Test_TC_TSUIC_2_1 : public TestCommand chip::Callback::Callback mOnFailureCallback_7{ OnFailureCallback_7, this }; chip::Callback::Callback mOnSuccessCallback_7{ OnSuccessCallback_7, this }; chip::Callback::Callback mOnFailureCallback_8{ OnFailureCallback_8, this }; - chip::Callback::Callback mOnSuccessCallback_8{ OnSuccessCallback_8, this }; - chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, this }; - chip::Callback::Callback mOnFailureCallback_10{ OnFailureCallback_10, this }; - chip::Callback::Callback mOnSuccessCallback_10{ - OnSuccessCallback_10, this - }; - chip::Callback::Callback mOnFailureCallback_11{ OnFailureCallback_11, this }; - chip::Callback::Callback mOnSuccessCallback_11{ - OnSuccessCallback_11, this - }; - chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; - chip::Callback::Callback mOnSuccessCallback_12{ - OnSuccessCallback_12, this - }; - chip::Callback::Callback mOnFailureCallback_13{ OnFailureCallback_13, this }; - chip::Callback::Callback mOnSuccessCallback_13{ - OnSuccessCallback_13, this + chip::Callback::Callback mOnSuccessCallback_8{ + OnSuccessCallback_8, this }; - chip::Callback::Callback mOnFailureCallback_14{ OnFailureCallback_14, this }; - chip::Callback::Callback mOnSuccessCallback_14{ - OnSuccessCallback_14, this + chip::Callback::Callback mOnFailureCallback_9{ OnFailureCallback_9, this }; + chip::Callback::Callback mOnSuccessCallback_9{ + OnSuccessCallback_9, this }; static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); } static void OnSuccessCallback_0(void * context, uint8_t temperatureDisplayMode) { - (static_cast(context))->OnSuccessResponse_0(temperatureDisplayMode); + (static_cast(context))->OnSuccessResponse_0(temperatureDisplayMode); } static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_1(status); } static void OnSuccessCallback_1(void * context, uint8_t temperatureDisplayMode) { - (static_cast(context))->OnSuccessResponse_1(temperatureDisplayMode); + (static_cast(context))->OnSuccessResponse_1(temperatureDisplayMode); } static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_2(void * context, uint8_t temperatureDisplayMode) + static void OnSuccessCallback_2(void * context, uint8_t keypadLockout) { - (static_cast(context))->OnSuccessResponse_2(temperatureDisplayMode); + (static_cast(context))->OnSuccessResponse_2(keypadLockout); } static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_3(void * context, uint8_t temperatureDisplayMode) + static void OnSuccessCallback_3(void * context, uint8_t keypadLockout) { - (static_cast(context))->OnSuccessResponse_3(temperatureDisplayMode); + (static_cast(context))->OnSuccessResponse_3(keypadLockout); } static void OnFailureCallback_4(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_4(void * context, uint8_t temperatureDisplayMode) + static void OnSuccessCallback_4(void * context, uint8_t keypadLockout) { - (static_cast(context))->OnSuccessResponse_4(temperatureDisplayMode); + (static_cast(context))->OnSuccessResponse_4(keypadLockout); } static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_5(status); } static void OnSuccessCallback_5(void * context, uint8_t keypadLockout) { - (static_cast(context))->OnSuccessResponse_5(keypadLockout); + (static_cast(context))->OnSuccessResponse_5(keypadLockout); } static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_6(status); } static void OnSuccessCallback_6(void * context, uint8_t keypadLockout) { - (static_cast(context))->OnSuccessResponse_6(keypadLockout); + (static_cast(context))->OnSuccessResponse_6(keypadLockout); } static void OnFailureCallback_7(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_7(status); } static void OnSuccessCallback_7(void * context, uint8_t keypadLockout) { - (static_cast(context))->OnSuccessResponse_7(keypadLockout); + (static_cast(context))->OnSuccessResponse_7(keypadLockout); } static void OnFailureCallback_8(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_8(status); } - static void OnSuccessCallback_8(void * context, uint8_t keypadLockout) + static void OnSuccessCallback_8(void * context, uint8_t scheduleProgrammingVisibility) { - (static_cast(context))->OnSuccessResponse_8(keypadLockout); + (static_cast(context))->OnSuccessResponse_8(scheduleProgrammingVisibility); } static void OnFailureCallback_9(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_9(status); - } - - static void OnSuccessCallback_9(void * context, uint8_t keypadLockout) - { - (static_cast(context))->OnSuccessResponse_9(keypadLockout); - } - - static void OnFailureCallback_10(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_10(status); - } - - static void OnSuccessCallback_10(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_10(scheduleProgrammingVisibility); - } - - static void OnFailureCallback_11(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_11(status); - } - - static void OnSuccessCallback_11(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_11(scheduleProgrammingVisibility); - } - - static void OnFailureCallback_12(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_12(status); - } - - static void OnSuccessCallback_12(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_12(scheduleProgrammingVisibility); - } - - static void OnFailureCallback_13(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_13(status); - } - - static void OnSuccessCallback_13(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_13(scheduleProgrammingVisibility); - } - - static void OnFailureCallback_14(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_14(status); + (static_cast(context))->OnFailureResponse_9(status); } - static void OnSuccessCallback_14(void * context, uint8_t scheduleProgrammingVisibility) + static void OnSuccessCallback_9(void * context, uint8_t scheduleProgrammingVisibility) { - (static_cast(context))->OnSuccessResponse_14(scheduleProgrammingVisibility); + (static_cast(context))->OnSuccessResponse_9(scheduleProgrammingVisibility); } // // Tests methods // - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_0() - { - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeTemperatureDisplayMode(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); - } - - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint8_t temperatureDisplayMode) - { - VerifyOrReturn(CheckValue("temperatureDisplayMode", temperatureDisplayMode, 0)); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_1() - { - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeTemperatureDisplayMode(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); - } - - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1(uint8_t temperatureDisplayMode) - { - VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); - NextTest(); - } - - CHIP_ERROR TestWriteToTheMandatoryAttributeTemperatureDisplayMode_2() + CHIP_ERROR TestWritesAValueOf0ToTemperatureDisplayModeAttributeOfDut_0() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); uint8_t temperatureDisplayModeArgument = static_cast(0); - return cluster.WriteAttributeTemperatureDisplayMode(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), + return cluster.WriteAttributeTemperatureDisplayMode(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel(), temperatureDisplayModeArgument); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t temperatureDisplayMode) { NextTest(); } + void OnSuccessResponse_0(uint8_t temperatureDisplayMode) { NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_3() + CHIP_ERROR TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_1() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeTemperatureDisplayMode(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); - } - - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_3(uint8_t temperatureDisplayMode) - { - VerifyOrReturn(CheckValue("temperatureDisplayMode", temperatureDisplayMode, 0)); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_4() - { - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevice, 1); + uint8_t temperatureDisplayModeArgument = static_cast(1); - return cluster.ReadAttributeTemperatureDisplayMode(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + return cluster.WriteAttributeTemperatureDisplayMode(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel(), + temperatureDisplayModeArgument); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint8_t temperatureDisplayMode) - { - VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); - NextTest(); - } + void OnSuccessResponse_1(uint8_t temperatureDisplayMode) { NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_5() + CHIP_ERROR TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_2() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeKeypadLockout(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); - } - - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_5(uint8_t keypadLockout) - { - VerifyOrReturn(CheckValue("keypadLockout", keypadLockout, 0)); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_6() - { - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevice, 1); + uint8_t keypadLockoutArgument = static_cast(0); - return cluster.ReadAttributeKeypadLockout(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + return cluster.WriteAttributeKeypadLockout(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel(), + keypadLockoutArgument); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(uint8_t keypadLockout) - { - VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); - NextTest(); - } + void OnSuccessResponse_2(uint8_t keypadLockout) { NextTest(); } - CHIP_ERROR TestWriteToTheMandatoryAttributeKeypadLockout_7() + CHIP_ERROR TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_3() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t keypadLockoutArgument = static_cast(0); + uint8_t keypadLockoutArgument = static_cast(1); - return cluster.WriteAttributeKeypadLockout(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel(), + return cluster.WriteAttributeKeypadLockout(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel(), keypadLockoutArgument); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(uint8_t keypadLockout) { NextTest(); } + void OnSuccessResponse_3(uint8_t keypadLockout) { NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_8() + CHIP_ERROR TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_4() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeKeypadLockout(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); - } - - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_8(uint8_t keypadLockout) - { - VerifyOrReturn(CheckValue("keypadLockout", keypadLockout, 0)); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_9() - { - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevice, 1); + uint8_t keypadLockoutArgument = static_cast(2); - return cluster.ReadAttributeKeypadLockout(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + return cluster.WriteAttributeKeypadLockout(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel(), + keypadLockoutArgument); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(uint8_t keypadLockout) - { - VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); - NextTest(); - } + void OnSuccessResponse_4(uint8_t keypadLockout) { NextTest(); } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_10() + CHIP_ERROR TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_5() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeScheduleProgrammingVisibility(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + uint8_t keypadLockoutArgument = static_cast(3); + + return cluster.WriteAttributeKeypadLockout(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel(), + keypadLockoutArgument); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint8_t scheduleProgrammingVisibility) - { - VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 0)); - NextTest(); - } + void OnSuccessResponse_5(uint8_t keypadLockout) { NextTest(); } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_11() + CHIP_ERROR TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_6() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeScheduleProgrammingVisibility(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + uint8_t keypadLockoutArgument = static_cast(4); + + return cluster.WriteAttributeKeypadLockout(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel(), + keypadLockoutArgument); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11(uint8_t scheduleProgrammingVisibility) - { - VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); - NextTest(); - } + void OnSuccessResponse_6(uint8_t keypadLockout) { NextTest(); } - CHIP_ERROR TestWriteToTheMandatoryAttributeScheduleProgrammingVisibility_12() + CHIP_ERROR TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_7() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t scheduleProgrammingVisibilityArgument = static_cast(0); + uint8_t keypadLockoutArgument = static_cast(5); - return cluster.WriteAttributeScheduleProgrammingVisibility(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel(), - scheduleProgrammingVisibilityArgument); + return cluster.WriteAttributeKeypadLockout(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel(), + keypadLockoutArgument); } - void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_12(uint8_t scheduleProgrammingVisibility) { NextTest(); } + void OnSuccessResponse_7(uint8_t keypadLockout) { NextTest(); } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_13() + CHIP_ERROR TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_8() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeScheduleProgrammingVisibility(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + uint8_t scheduleProgrammingVisibilityArgument = static_cast(0); + + return cluster.WriteAttributeScheduleProgrammingVisibility(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel(), + scheduleProgrammingVisibilityArgument); } - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_13(uint8_t scheduleProgrammingVisibility) - { - VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 0)); - NextTest(); - } + void OnSuccessResponse_8(uint8_t scheduleProgrammingVisibility) { NextTest(); } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_14() + CHIP_ERROR TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_9() { chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeScheduleProgrammingVisibility(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel()); + uint8_t scheduleProgrammingVisibilityArgument = static_cast(1); + + return cluster.WriteAttributeScheduleProgrammingVisibility(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel(), + scheduleProgrammingVisibilityArgument); } - void OnFailureResponse_14(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_14(uint8_t scheduleProgrammingVisibility) - { - VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); - NextTest(); - } + void OnSuccessResponse_9(uint8_t scheduleProgrammingVisibility) { NextTest(); } }; class Test_TC_DIAGTH_1_1 : public TestCommand @@ -16615,6 +19771,120 @@ class Test_TC_WNCV_2_1 : public TestCommand } }; +class Test_TC_WNCV_2_5 : public TestCommand +{ +public: + Test_TC_WNCV_2_5() : TestCommand("Test_TC_WNCV_2_5"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_5\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_2_5\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 : Reads EndProductType attribute from DUT\n"); + err = TestReadsEndProductTypeAttributeFromDut_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads EndProductType attribute constraints from DUT\n"); + err = TestReadsEndProductTypeAttributeConstraintsFromDut_1(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 2; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint8_t endProductType) + { + (static_cast(context))->OnSuccessResponse_0(endProductType); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t endProductType) + { + (static_cast(context))->OnSuccessResponse_1(endProductType); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadsEndProductTypeAttributeFromDut_0() + { + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeEndProductType(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0(uint8_t endProductType) + { + VerifyOrReturn(CheckValue("endProductType", endProductType, 0)); + NextTest(); + } + + CHIP_ERROR TestReadsEndProductTypeAttributeConstraintsFromDut_1() + { + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeEndProductType(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint8_t endProductType) + { + VerifyOrReturn(CheckConstraintType("endProductType", "", "enum8")); + VerifyOrReturn(CheckConstraintMaxValue("endProductType", endProductType, 23)); + NextTest(); + } +}; + class Test_TC_WNCV_3_1 : public TestCommand { public: @@ -24494,6 +27764,161 @@ class TestModeSelectCluster : public TestCommand void OnSuccessResponse_7() { ThrowSuccessResponse(); } }; +class Test_TC_DIAGSW_1_1 : public TestCommand +{ +public: + Test_TC_DIAGSW_1_1() : TestCommand("Test_TC_DIAGSW_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DIAGSW_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DIAGSW_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 : Reads CurrentHeapFree non-global attribute value from DUT\n"); + err = TestReadsCurrentHeapFreeNonGlobalAttributeValueFromDut_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads CurrentHeapUsed non-global attribute value from DUT\n"); + err = TestReadsCurrentHeapUsedNonGlobalAttributeValueFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads CurrentHeapHighWaterMark non-global attribute value from DUT\n"); + err = TestReadsCurrentHeapHighWaterMarkNonGlobalAttributeValueFromDut_2(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + chip::Callback::Callback mOnFailureCallback_1{ OnFailureCallback_1, this }; + chip::Callback::Callback mOnSuccessCallback_1{ OnSuccessCallback_1, this }; + chip::Callback::Callback mOnFailureCallback_2{ OnFailureCallback_2, this }; + chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, + this }; + + static void OnFailureCallback_0(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_0(status); + } + + static void OnSuccessCallback_0(void * context, uint64_t currentHeapFree) + { + (static_cast(context))->OnSuccessResponse_0(currentHeapFree); + } + + static void OnFailureCallback_1(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint64_t currentHeapUsed) + { + (static_cast(context))->OnSuccessResponse_1(currentHeapUsed); + } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint64_t currentHeapHighWatermark) + { + (static_cast(context))->OnSuccessResponse_2(currentHeapHighWatermark); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadsCurrentHeapFreeNonGlobalAttributeValueFromDut_0() + { + chip::Controller::SoftwareDiagnosticsClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentHeapFree(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } + + void OnFailureResponse_0(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_0(uint64_t currentHeapFree) + { + VerifyOrReturn(CheckConstraintType("currentHeapFree", "", "uint64")); + NextTest(); + } + + CHIP_ERROR TestReadsCurrentHeapUsedNonGlobalAttributeValueFromDut_1() + { + chip::Controller::SoftwareDiagnosticsClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentHeapUsed(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + } + + void OnFailureResponse_1(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_1(uint64_t currentHeapUsed) + { + VerifyOrReturn(CheckConstraintType("currentHeapUsed", "", "uint64")); + NextTest(); + } + + CHIP_ERROR TestReadsCurrentHeapHighWaterMarkNonGlobalAttributeValueFromDut_2() + { + chip::Controller::SoftwareDiagnosticsClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeCurrentHeapHighWatermark(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } + + void OnSuccessResponse_2(uint64_t currentHeapHighWatermark) + { + VerifyOrReturn(CheckConstraintType("currentHeapHighWatermark", "", "uint64")); + NextTest(); + } +}; + class TestSubscribe_OnOff : public TestCommand { public: @@ -24781,6 +28206,7 @@ void registerCommandsTests(Commands & commands) commands_list clusterCommands = { make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -24801,6 +28227,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -24810,6 +28238,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -24825,23 +28255,30 @@ 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(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -24866,6 +28303,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), };