diff --git a/examples/chip-tool/templates/tests.js b/examples/chip-tool/templates/tests.js index 4790e4372e25f5..8961aea870e187 100644 --- a/examples/chip-tool/templates/tests.js +++ b/examples/chip-tool/templates/tests.js @@ -48,6 +48,7 @@ function getTests() 'Test_TC_CC_7_3', 'Test_TC_CC_7_4', 'Test_TC_CC_8_1', + 'Test_TC_CC_9_1', 'Test_TC_CC_9_2', 'Test_TC_CC_9_3', ]; @@ -102,6 +103,7 @@ function getTests() 'Test_TC_OO_1_1', 'Test_TC_OO_2_1', 'Test_TC_OO_2_2', + 'Test_TC_OO_2_3', ]; const PressureMeasurement = [ @@ -145,6 +147,7 @@ function getTests() const WindowCovering = [ 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', + 'Test_TC_WNCV_2_2', 'Test_TC_WNCV_2_5', 'Test_TC_WNCV_3_1', 'Test_TC_WNCV_3_2', diff --git a/src/app/tests/suites/certification/Test_TC_CC_9_1.yaml b/src/app/tests/suites/certification/Test_TC_CC_9_1.yaml new file mode 100644 index 00000000000000..bb191c60cc2d0a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CC_9_1.yaml @@ -0,0 +1,577 @@ +# 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.20. [TC-CC-9.1] ColorLoopSet Validation + +config: + cluster: "Color Control" + endpoint: 1 + +tests: + - label: "Precondition : Turn on light for color control tests" + cluster: "On/Off" + command: "on" + + - label: "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: 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 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 2 + - 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 ColorLoopDirection attribute from DUT" + command: "readAttribute" + attribute: "color loop direction" + response: + value: 0 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 4 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 30 + - 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: 30 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 8 + - name: "action" + value: 0 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 160 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Read ColorLoopStartEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "color loop start enhanced hue" + response: + value: 160 + + - label: "Sends ColorLoopSet 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 Disabled as value needs to be same as EnhancedCurrentHue + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." + disabled: true + command: "readAttribute" + attribute: "color loop stored 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: "Sends ColorLoopSet Command - Set all Attributes" + 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 Disabled as value needs to be same as EnhancedCurrentHue + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + 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 + + - label: "Sends ColorLoopSet 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 Disabled as value needs to be same as EnhancedCurrentHue + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "color loop stored 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: "Sends ColorLoopSet Command - Set all Attributes" + 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 Disabled as value needs to be same as ColorLoopStoredEnhancedHue. + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Enhanced Move To Hue command 10" + command: "EnhancedMoveToHue" + arguments: + values: + - name: "enhancedHue" + value: 40960 + - name: "direction" + value: 0 + - name: "transitionTime" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + - label: "Wait 2000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 2000 + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 40960 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 2 + - 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 ColorLoopDirection attribute from DUT" + command: "readAttribute" + attribute: "color loop direction" + response: + value: 0 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 2 + - name: "direction" + value: 0 + - name: "time" + value: 0 + - name: "startHue" + value: 0 + - name: "optionsMask" + value: 0 + - name: "optionsOverride" + value: 0 + + #Issue #335 expected value is 2 but returned is 1 + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "color loop active" + response: + value: 1 + + #Issue# 10816 Disabled as value needs to be same as EnhancedCurrentHue. + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "color loop stored 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: "Sends ColorLoopSet Command - Set all Attributes" + 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 Disabled as value needs to be same as ColorLoopStoredEnhancedHue. + - label: "Read EnhancedCurrentHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "enhanced current hue" + response: + value: 0 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + 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 + + #Issue #336 expected value is 1 but returned is 2 + - label: "Read ColorLoopDirection attribute from DUT" + command: "readAttribute" + attribute: "color loop direction" + response: + value: 1 + + - label: "Sends ColorLoopSet Command - Set all Attributes" + command: "ColorLoopSet" + arguments: + values: + - name: "updateFlags" + value: 1 + - name: "action" + value: 2 + - 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 Disabled as value needs to be same as EnhancedCurrentHue. + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "color loop stored 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: "Sends ColorLoopSet Command - Set all Attributes" + 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 Disabled as value needs to be same as ColorLoopStoredEnhancedHue.. + - 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_OO_2_3.yaml b/src/app/tests/suites/certification/Test_TC_OO_2_3.yaml new file mode 100644 index 00000000000000..49b79183e2fa04 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_OO_2_3.yaml @@ -0,0 +1,1000 @@ +# 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: 3.2.3. [TC-OO-2.3] Secondary functionality with server as DUT + +config: + cluster: "On/Off" + endpoint: 1 + +tests: + - label: "Send On Command" + command: "On" + + - label: "Wait 1000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + #Issue #339/#9810 OffWithEffect command is failing + - label: "Sends OffWithEffect command to DUT" + disabled: true + command: "OffWithEffect" + arguments: + values: + - name: "EffectId" + value: 0 + - name: "EffectVariant" + value: 0 + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 0 + + #Issue #339/#9810 OnWithRecallGlobalScene command is failing + - label: "Sends OnWithRecallGlobalScene command to DUT" + disabled: true + command: "OnWithRecallGlobalScene" + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + #Issue #339/#9810 OffWithEffect command is failing + - label: "Sends OffWithEffect command to DUT" + disabled: true + command: "OffWithEffect" + arguments: + values: + - name: "EffectId" + value: 0 + - name: "EffectVariant" + value: 0 + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 0 + + - label: "Send On Command" + command: "On" + + - label: "Wait 1000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + #Issue #339/#9810 OffWithEffect command is failing + - label: "Sends OffWithEffect command to DUT" + disabled: true + command: "OffWithEffect" + arguments: + values: + - name: "EffectId" + value: 0 + - name: "EffectVariant" + value: 0 + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 0 + + - label: "Send On Command" + command: "On" + + - label: "Wait 1000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + #Issue #339/#9810 OnWithRecallGlobalScene command is failing + - label: "Sends OnWithRecallGlobalScene command to DUT" + disabled: true + command: "OnWithRecallGlobalScene" + + - label: "Wait 1000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads GlobalSceneControl attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "GlobalSceneControl" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OffWithEffect command is failing + - label: "Sends OffWithEffect command to DUT" + disabled: true + command: "OffWithEffect" + arguments: + values: + - name: "EffectId" + value: 0 + - name: "EffectVariant" + value: 0 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 200 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + - label: "Send On Command" + command: "On" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + - label: "Send Off Command" + command: "Off" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 30000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 30000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Send On Command" + command: "On" + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 40000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 40000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 0 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 1 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 200 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Send Off Command" + command: "Off" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 0 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 200 + + - label: "Send On Command" + command: "On" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Wait 10000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 0 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Send Off Command" + command: "Off" + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 40000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 40000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + #Issue #339/#9810 OnWithTimedOff command is failing + - label: "Sends OnWithTimedOff command to DUT" + disabled: true + command: "OnWithTimedOff" + arguments: + values: + - name: "OnOffControl" + value: 0 + - name: "OnTime" + value: 300 + - name: "OffWaitTime" + value: 300 + + - label: "Reads OnOff attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnOff" + response: + value: 1 + + - label: "Reads OnTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OnTime" + response: + value: 300 + + - label: "Reads OffWaitTime attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 300 + + - label: "Wait 40000ms" + disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 40000 + + - label: "Reads OnOff attribute from DUT" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 + + - label: "Reads OnTime attribute from DUT" + command: "readAttribute" + attribute: "OnTime" + response: + value: 0 + + - label: "Reads OffWaitTime attribute from DUT" + command: "readAttribute" + attribute: "OffWaitTime" + response: + value: 0 + + - label: "Send Off Command" + command: "Off" diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_2_2.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_2_2.yaml new file mode 100644 index 00000000000000..6fbb7050fe2980 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WNCV_2_2.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.2. [TC-WNCV-2.2] ConfigStatus Attribute with server as DUT + +config: + cluster: "Window Covering" + endpoint: 1 + +tests: + #Issue #10811 if condition is required, need YAML support for this + - label: "Reads ConfigStatus attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "ConfigStatus" + response: + value: 4 + + - label: "Reads ConfigStatus attribute from DUT" + disabled: true + command: "readAttribute" + attribute: "ConfigStatus" + response: + value: 8 diff --git a/src/darwin/Framework/CHIP/templates/tests.js b/src/darwin/Framework/CHIP/templates/tests.js index d0e73c1180f70b..1e92e9cf8d6623 100644 --- a/src/darwin/Framework/CHIP/templates/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests.js @@ -48,6 +48,7 @@ function getTests() 'Test_TC_CC_7_3', 'Test_TC_CC_7_4', 'Test_TC_CC_8_1', + 'Test_TC_CC_9_1', 'Test_TC_CC_9_2', 'Test_TC_CC_9_3', ]; @@ -101,6 +102,7 @@ function getTests() 'Test_TC_OO_1_1', 'Test_TC_OO_2_1', 'Test_TC_OO_2_2', + 'Test_TC_OO_2_3', ]; const PressureMeasurement = [ @@ -144,6 +146,7 @@ function getTests() const WindowCovering = [ 'Test_TC_WNCV_1_1', 'Test_TC_WNCV_2_1', + 'Test_TC_WNCV_2_2', 'Test_TC_WNCV_2_5', 'Test_TC_WNCV_3_1', 'Test_TC_WNCV_3_2', diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index b8fd559dd8641a..450c41139ba5bd 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -6437,9 +6437,9 @@ - (void)testSendClusterTest_TC_CC_8_1_000015_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000000_On +- (void)testSendClusterTest_TC_CC_9_1_000000_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition : Turn on light for color control tests"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6447,7 +6447,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000000_On XCTAssertNotNil(cluster); [cluster on:^(NSError * err, NSDictionary * values) { - NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); + NSLog(@"Precondition : Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6456,10 +6456,9 @@ - (void)testSendClusterTest_TC_CC_9_2_000000_On [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000001_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6467,7 +6466,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Precondition: Check on/off attribute value is true after on command Error: %@", err); + NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6478,7 +6477,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000002_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000002_ColorLoopSet { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; @@ -6487,11 +6486,11 @@ - (void)testSendClusterTest_TC_CC_9_2_000002_ColorLoopSet CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t updateFlagsArgument = 15; + uint8_t updateFlagsArgument = 1; uint8_t actionArgument = 0; uint8_t directionArgument = 0; - uint16_t timeArgument = 30U; - uint16_t startHueArgument = 160U; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster colorLoopSet:updateFlagsArgument @@ -6511,7 +6510,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000002_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000003_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; @@ -6532,9 +6531,42 @@ - (void)testSendClusterTest_TC_CC_9_2_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000004_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; + 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 = 2; + 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(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6542,7 +6574,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6553,62 +6585,74 @@ - (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000005_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000006_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; + 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); - [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); - - XCTAssertEqual(err.code, 0); + uint8_t updateFlagsArgument = 4; + uint8_t actionArgument = 0; + uint8_t directionArgument = 0; + uint16_t timeArgument = 30U; + 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(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000006_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; + 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 readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); + [cluster readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); + XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000007_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000008_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; + 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 = 1; - uint8_t actionArgument = 1; + uint8_t updateFlagsArgument = 8; + uint8_t actionArgument = 0; uint8_t directionArgument = 0; uint16_t timeArgument = 0U; - uint16_t startHueArgument = 0U; + uint16_t startHueArgument = 160U; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster colorLoopSet:updateFlagsArgument @@ -6619,7 +6663,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000007_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6628,39 +6672,39 @@ - (void)testSendClusterTest_TC_CC_9_2_000007_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000008_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; + 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 readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); + [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000010_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + 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 = 2; - uint8_t actionArgument = 0; - uint8_t directionArgument = 1; + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 1; + uint8_t directionArgument = 0; uint16_t timeArgument = 0U; uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; @@ -6673,7 +6717,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6682,17 +6726,17 @@ - (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; + 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 readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6703,9 +6747,9 @@ - (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000011_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000012_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6727,7 +6771,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000011_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6736,7 +6780,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000011_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000012_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000013_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; @@ -6757,68 +6801,115 @@ - (void)testSendClusterTest_TC_CC_9_2_000012_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000013_Off +- (void)testSendClusterTest_TC_CC_9_1_000014_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl 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); + 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(@"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_CC_9_3_000000_On +- (void)testSendClusterTest_TC_CC_9_1_000015_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl 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); + [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_3_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000016_ColorLoopSet { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl 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); + 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(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_1_000017_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"] boolValue], 1); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000002_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000018_ColorLoopSet { XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; @@ -6827,11 +6918,11 @@ - (void)testSendClusterTest_TC_CC_9_3_000002_ColorLoopSet CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t updateFlagsArgument = 15; + uint8_t updateFlagsArgument = 1; uint8_t actionArgument = 0; uint8_t directionArgument = 0; - uint16_t timeArgument = 30U; - uint16_t startHueArgument = 160U; + uint16_t timeArgument = 0U; + uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; [cluster colorLoopSet:updateFlagsArgument @@ -6851,7 +6942,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000002_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000003_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000019_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; @@ -6872,72 +6963,121 @@ - (void)testSendClusterTest_TC_CC_9_3_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000004_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000020_EnhancedMoveToHue { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Enhanced Move To Hue command 10"]; 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); + uint16_t enhancedHueArgument = 40960U; + uint8_t directionArgument = 0; + uint16_t transitionTimeArgument = 0U; + uint8_t optionsMaskArgument = 0; + uint8_t optionsOverrideArgument = 0; + [cluster enhancedMoveToHue:enhancedHueArgument + direction:directionArgument + transitionTime:transitionTimeArgument + optionsMask:optionsMaskArgument + optionsOverride:optionsOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Enhanced Move To Hue command 10 Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + [expectation fulfill]; + }]; - [expectation fulfill]; - }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_1_000021_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 2000ms"]; + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 2000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000005_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000022_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue 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); + [cluster readAttributeEnhancedCurrentHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 30U); + XCTAssertEqual([values[@"value"] unsignedShortValue], 40960U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000006_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000023_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; + 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); - [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); + uint8_t updateFlagsArgument = 2; + 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(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_1_000024_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"] unsignedShortValue], 160U); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000025_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6945,7 +7085,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet XCTAssertNotNil(cluster); uint8_t updateFlagsArgument = 1; - uint8_t actionArgument = 1; + uint8_t actionArgument = 2; uint8_t directionArgument = 0; uint16_t timeArgument = 0U; uint16_t startHueArgument = 0U; @@ -6959,7 +7099,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Set all Attributes Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6968,9 +7108,9 @@ - (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000008_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000026_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -6978,7 +7118,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000008_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -6989,19 +7129,19 @@ - (void)testSendClusterTest_TC_CC_9_3_000008_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000009_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000027_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + 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 = 4; + uint8_t updateFlagsArgument = 1; uint8_t actionArgument = 0; uint8_t directionArgument = 0; - uint16_t timeArgument = 60U; + uint16_t timeArgument = 0U; uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; uint8_t optionsOverrideArgument = 0; @@ -7013,7 +7153,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000009_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7022,39 +7162,39 @@ - (void)testSendClusterTest_TC_CC_9_3_000009_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000010_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000028_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; + 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 readAttributeColorLoopTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); + [cluster readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 60U); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000011_ColorLoopSet +- (void)testSendClusterTest_TC_CC_9_1_000029_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; + 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 = 1; + uint8_t updateFlagsArgument = 2; uint8_t actionArgument = 0; - uint8_t directionArgument = 0; + uint8_t directionArgument = 1; uint16_t timeArgument = 0U; uint16_t startHueArgument = 0U; uint8_t optionsMaskArgument = 0; @@ -7067,7 +7207,7 @@ - (void)testSendClusterTest_TC_CC_9_3_000011_ColorLoopSet optionsMask:optionsMaskArgument optionsOverride:optionsOverrideArgument responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Color Loop Set Command - Start Color Loop Error: %@", err); + NSLog(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7076,138 +7216,166 @@ - (void)testSendClusterTest_TC_CC_9_3_000011_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000012_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000030_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; + 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 readAttributeColorLoopActiveWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_3_000013_Off +- (void)testSendClusterTest_TC_CC_9_1_000031_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl 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); + uint8_t updateFlagsArgument = 1; + uint8_t actionArgument = 2; + 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(@"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_000000_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000032_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Interaction Model Version"]; + 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 readAttributeInteractionModelVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Interaction Model Version Error: %@", err); + [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_DM_1_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000033_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Vendor Name"]; + 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 readAttributeVendorNameWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Vendor Name Error: %@", err); - - XCTAssertEqual(err.code, 0); + 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(@"Sends ColorLoopSet Command - Set all Attributes Error: %@", err); - XCTAssertLessThanOrEqual([values[@"value"] length], 32); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000034_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query VendorID"]; + 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 readAttributeVendorIDWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query VendorID Error: %@", err); + [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_DM_1_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_1_000035_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Product Name"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn Off 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 readAttributeProductNameWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Product Name Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn Off light for color control tests 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 + +- (void)testSendClusterTest_TC_CC_9_2_000000_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductID"]; + 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 readAttributeProductIDWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query ProductID Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7216,301 +7384,318 @@ - (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Label"]; + 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 readAttributeUserLabelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query User Label 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_000006_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000002_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Location"]; + 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 readAttributeLocationWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query User Location Error: %@", err); - - XCTAssertEqual(err.code, 0); + 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); - XCTAssertLessThanOrEqual([values[@"value"] length], 2); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersion"]; + 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 readAttributeHardwareVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query HardwareVersion Error: %@", err); + [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_DM_1_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersionString"]; + 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 readAttributeHardwareVersionStringWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query HardwareVersionString Error: %@", err); + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); - XCTAssertLessThanOrEqual([values[@"value"] length], 64); + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersion"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime 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 readAttributeSoftwareVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query SoftwareVersion Error: %@", err); + [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_DM_1_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersionString"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue 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 readAttributeSoftwareVersionStringWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query SoftwareVersionString Error: %@", err); + [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); - XCTAssertLessThanOrEqual([values[@"value"] length], 64); + XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000011_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000007_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ManufacturingDate"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set 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 readAttributeManufacturingDateWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query ManufacturingDate Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual(err.code, 0); + 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); - XCTAssertGreaterThanOrEqual([values[@"value"] length], 8); - XCTAssertLessThanOrEqual([values[@"value"] length], 16); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000012_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000008_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query PartNumber"]; + 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 readAttributePartNumberWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query PartNumber Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [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], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000013_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductURL"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; 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 readAttributeProductURLWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query ProductURL Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual(err.code, 0); + 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); - XCTAssertLessThanOrEqual([values[@"value"] length], 256); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000014_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductLabel"]; + 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 readAttributeProductLabelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query ProductLabel Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [cluster readAttributeColorLoopDirectionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] length], 64); + XCTAssertEqual([values[@"value"] unsignedCharValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000015_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000011_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query SerialNumber"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; 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 readAttributeSerialNumberWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query SerialNumber Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual(err.code, 0); + 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); - XCTAssertLessThanOrEqual([values[@"value"] length], 32); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_DM_1_1_000016_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000012_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query LocalConfigDisabled"]; + 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 readAttributeLocalConfigDisabledWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query LocalConfigDisabled Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [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_DM_1_1_000017_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000013_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Query Reachable"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off 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 readAttributeReachableWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Query Reachable Error: %@", err); - - if (err.code == CHIPErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn off light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); @@ -7520,1057 +7705,2721 @@ - (void)testSendClusterTest_TC_DM_1_1_000017_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_EMR_1_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000000_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: Turn on light for color control tests"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Precondition: Turn on light for color control tests Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 3U); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_EMR_1_1_000001_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000001_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - uint16_t clusterRevisionArgument = 1U; - [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_EMR_1_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + [self expectationWithDescription:@"Precondition: Check on/off attribute value is true after on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back global attribute: ClusterRevision 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); - XCTAssertEqual([values[@"value"] unsignedShortValue], 3U); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_FLW_1_1_000000_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000002_ColorLoopSet { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends ColorLoopSet Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl 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); + 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, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_FLW_2_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + [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_FLW_2_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopDirection attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + [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_FLW_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + [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_FLW_2_1_000003_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000006_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default value to optional attribute: MinMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStartEnhancedHue attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl 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 value to optional attribute: MinMeasuredValue Error: %@", err); + [cluster readAttributeColorLoopStartEnhancedHueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 160U); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000004_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000007_ColorLoopSet { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default value to optional attribute: MaxMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl 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 value to optional attribute: MaxMeasuredValue Error: %@", err); + 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, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000008_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + [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_FLW_2_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000009_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + 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); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopTime attribute from DUT."]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + [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_FLW_2_2_000000_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000011_ColorLoopSet { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Start Color Loop"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + 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); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_FLW_2_2_000001_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_3_000012_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + [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_LVL_1_1_000000_WriteAttribute +- (void)testSendClusterTest_TC_CC_9_3_000013_Off { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Turn off light for color control tests"]; 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); - uint16_t clusterRevisionArgument = 4U; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Turn off light for color control tests Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000000_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Interaction Model Version"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeInteractionModelVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Interaction Model Version Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000001_MoveToLevel +- (void)testSendClusterTest_TC_DM_1_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Vendor Name"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - uint8_t levelArgument = 64; - 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(@"sends a Move to level command Error: %@", err); + [cluster readAttributeVendorNameWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Vendor Name Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertLessThanOrEqual([values[@"value"] length], 32); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query VendorID"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeVendorIDWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query VendorID Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 64); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000004_MoveToLevel +- (void)testSendClusterTest_TC_DM_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Product Name"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - uint8_t levelArgument = 128; - uint16_t transitionTimeArgument = 1U; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster moveToLevel:levelArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeProductNameWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Product Name Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertLessThanOrEqual([values[@"value"] length], 32); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000005_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 200ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 200); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductID"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeProductIDWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query ProductID Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 128); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads On Off Transition Time attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Label"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnOffTransitionTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads On Off Transition Time attribute from DUT Error: %@", err); + [cluster readAttributeUserLabelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query User Label Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + XCTAssertLessThanOrEqual([values[@"value"] length], 32); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000008_MoveToLevel +- (void)testSendClusterTest_TC_DM_1_1_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query User Location"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - uint8_t levelArgument = 254; - uint16_t transitionTimeArgument = 65535U; - uint8_t optionMaskArgument = 1; - uint8_t optionOverrideArgument = 1; - [cluster moveToLevel:levelArgument - transitionTime:transitionTimeArgument - optionMask:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeLocationWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query User Location Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertLessThanOrEqual([values[@"value"] length], 2); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000009_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 10ms"]; + [expectation fulfill]; + }]; - 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 +- (void)testSendClusterTest_TC_DM_1_1_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersion"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeHardwareVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query HardwareVersion 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 +- (void)testSendClusterTest_TC_DM_1_1_000008_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 0"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query HardwareVersionString"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 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); + [cluster readAttributeHardwareVersionStringWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query HardwareVersionString Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); + XCTAssertLessThanOrEqual([values[@"value"] length], 64); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000012_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + [expectation fulfill]; + }]; - 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 +- (void)testSendClusterTest_TC_DM_1_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersion"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeSoftwareVersionWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query SoftwareVersion 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 +- (void)testSendClusterTest_TC_DM_1_1_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads max level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query SoftwareVersionString"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads max level attribute from DUT Error: %@", err); + [cluster readAttributeSoftwareVersionStringWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query SoftwareVersionString Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + XCTAssertGreaterThanOrEqual([values[@"value"] length], 1); + XCTAssertLessThanOrEqual([values[@"value"] length], 64); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000002_Move +- (void)testSendClusterTest_TC_DM_1_1_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query ManufacturingDate"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 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); + [cluster readAttributeManufacturingDateWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query ManufacturingDate Error: %@", err); + if (err.code == CHIPErrorCodeUnsupportedAttribute) { [expectation fulfill]; - }]; + return; + } - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000003_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTAssertEqual(err.code, 0); + + XCTAssertGreaterThanOrEqual([values[@"value"] length], 8); + XCTAssertLessThanOrEqual([values[@"value"] length], 16); + + [expectation fulfill]; + }]; - 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 +- (void)testSendClusterTest_TC_DM_1_1_000012_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query PartNumber"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributePartNumberWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query PartNumber Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 255); + XCTAssertLessThanOrEqual([values[@"value"] length], 32); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_DM_1_1_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads min level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductURL"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { + [cluster readAttributeProductURLWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query ProductURL Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] length], 256); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000014_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query ProductLabel"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeProductLabelWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query ProductLabel Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] length], 64); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000015_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query SerialNumber"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeSerialNumberWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query SerialNumber Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] length], 32); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000016_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query LocalConfigDisabled"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeLocalConfigDisabledWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query LocalConfigDisabled Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_DM_1_1_000017_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Query Reachable"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBasic * cluster = [[CHIPTestBasic alloc] initWithDevice:device endpoint:0 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeReachableWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Query Reachable Error: %@", err); + + if (err.code == CHIPErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_EMR_1_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement 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], 3U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_EMR_1_1_000001_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(); + CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 1U; + [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_EMR_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestElectricalMeasurement * cluster = [[CHIPTestElectricalMeasurement 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], 3U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_FLW_1_1_000000_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(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement 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_FLW_2_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement 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_FLW_2_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000003_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default value to optional attribute: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement 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 value to optional attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000004_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default value to optional attribute: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement 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 value to optional attribute: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement 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_FLW_2_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_FLW_2_1_000007_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxMeasuredValueWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_FLW_2_2_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement 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_FLW_2_2_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestFlowMeasurement * cluster = [[CHIPTestFlowMeasurement 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_LVL_1_1_000000_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(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 4U; + [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_LVL_2_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_2_1_000001_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level 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 levelArgument = 64; + 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(@"sends a Move to level command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000002_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_2_1_000003_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], 64); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000004_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level 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 levelArgument = 128; + uint16_t transitionTimeArgument = 1U; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster moveToLevel:levelArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move to level command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000005_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 200ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 200); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_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], 128); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads On Off Transition Time 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 readAttributeOnOffTransitionTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads On Off Transition Time attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_2_1_000008_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level 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 levelArgument = 254; + uint16_t transitionTimeArgument = 65535U; + uint8_t optionMaskArgument = 1; + uint8_t optionOverrideArgument = 1; + [cluster moveToLevel:levelArgument + transitionTime:transitionTimeArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"sends a Move to level command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (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); + [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); + 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_3_1_000010_ReadAttribute +{ + 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 readAttributeDefaultMoveRateWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads default move rate attribute from DUT 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 +{ + 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 moveModeArgument = 1; + uint8_t rateArgument = 255; + 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 at default move rate Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_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_000013_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); + + XCTAssertNotEqual([values[@"value"] unsignedCharValue], 255); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_4_1_000000_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending 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 on:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending on command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000001_Step +{ + 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 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_4_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_4_1_000003_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], 128); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000004_Step +{ + 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); + + 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], 64); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000007_Step +{ + 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 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 Step up command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000008_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_000009_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], 128); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000010_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]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_5_1_000000_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending 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 on:^(NSError * err, NSDictionary * values) { + NSLog(@"Sending on command Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000001_Step +{ + 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 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 + rate:rateArgument + optionMask:optionMaskArgument + optionOverride:optionOverrideArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Sends a move up command to DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000004_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_000005_Stop +{ + 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); + + 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); + + [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]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_1_1_000000_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(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 1U; + [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_MC_2_1_000000_Sleep +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Put the device into low power mode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster sleep:^(NSError * err, NSDictionary * values) { + NSLog(@"Put the device into low power mode Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_OCC_1_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing 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_OCC_1_1_000001_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(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing 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_OCC_2_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads mandatory attribute constrains: Occupancy"]; + + 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 mandatory attribute constrains: Occupancy Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000001_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: Occupancy"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t occupancyArgument = 0; + [cluster writeAttributeOccupancyWithValue:occupancyArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes the respective default value to mandatory attribute: Occupancy Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: Occupancy"]; + + 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 back mandatory attribute: Occupancy Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorType"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancySensorTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads mandatory attribute constrains: OccupancySensorType Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 3); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000004_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorType"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t occupancySensorTypeArgument = 0; + [cluster writeAttributeOccupancySensorTypeWithValue:occupancySensorTypeArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes the respective default value to mandatory attribute: " + @"OccupancySensorType Error: %@", + err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorType"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancySensorTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back mandatory attribute: OccupancySensorType Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancySensorTypeBitmapWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertGreaterThanOrEqual([values[@"value"] unsignedCharValue], 1); + XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 7); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000007_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint8_t occupancySensorTypeBitmapArgument = 1; + [cluster writeAttributeOccupancySensorTypeBitmapWithValue:occupancySensorTypeBitmapArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Writes the respective default value to mandatory attribute: " + @"OccupancySensorTypeBitmap Error: %@", + err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OCC_2_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorTypeBitmap"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOccupancySensorTypeBitmapWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads back mandatory attribute: OccupancySensorTypeBitmap Error: %@", err); + + XCTAssertEqual(err.code, 0); + + 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]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_OO_1_1_000000_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff 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], 4U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_1_1_000001_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(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t clusterRevisionArgument = 3U; + [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_OO_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff 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], 4U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000006_Move +- (void)testSendClusterTest_TC_OO_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move down command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; 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 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); + [cluster readAttributeFeatureMapWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] unsignedLongValue], 0UL); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000007_WaitForMs +- (void)testSendClusterTest_TC_OO_1_1_000004_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to optional global attribute: FeatureMap"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint32_t featureMapArgument = 0UL; + [cluster writeAttributeFeatureMapWithValue:featureMapArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + + XCTAssertEqual(err.code, 1); + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_OO_1_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back optional global attribute: FeatureMap"]; 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 readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeFeatureMapWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedLongValue], 0UL); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000009_WriteAttribute + +- (void)testSendClusterTest_TC_OO_2_1_000000_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Write default move rate attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: OnOff"]; 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 readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read the mandatory attribute: OnOff Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads default move rate attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back mandatory attribute: OnOff"]; 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 readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back mandatory attribute: OnOff Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 20); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000011_Move +- (void)testSendClusterTest_TC_OO_2_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command at default move rate"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: GlobalSceneControl"]; 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 moveModeArgument = 1; - uint8_t rateArgument = 255; - 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 at default move rate Error: %@", err); + [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read LT attribute: GlobalSceneControl Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 1); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000012_WaitForMs +- (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OnTime"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read LT attribute: OnTime Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OffWaitTime"]; 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 readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read LT attribute: OffWaitTime Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertNotEqual([values[@"value"] unsignedCharValue], 255); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: StartUpOnOff"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeStartUpOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"read LT attribute: StartUpOnOff Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_OO_2_1_000006_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OnTime"]; -- (void)testSendClusterTest_TC_LVL_4_1_000000_On + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t onTimeArgument = 0U; + [cluster writeAttributeOnTimeWithValue:onTimeArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default value to LT attribute: OnTime Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_1_000007_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OffWaitTime"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + uint16_t offWaitTimeArgument = 0U; + [cluster writeAttributeOffWaitTimeWithValue:offWaitTimeArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default value to LT attribute: OffWaitTime Error: %@", err); + + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_1_000008_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: StartUpOnOff"]; 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(@"Sending on command Error: %@", err); + uint8_t startUpOnOffArgument = 0; + [cluster writeAttributeStartUpOnOffWithValue:startUpOnOffArgument + responseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"write the default value to LT attribute: StartUpOnOff Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000001_Step +- (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OnTime"]; 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 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); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back LT attribute: OnTime Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_1_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OffWaitTime"]; 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 readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back LT attribute: OffWaitTime Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 128); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000004_Step +- (void)testSendClusterTest_TC_OO_2_1_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step down command to DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: StartUpOnOff"]; 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 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); + [cluster readAttributeStartUpOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"reads back LT attribute: StartUpOnOff Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] unsignedCharValue], 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000005_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - 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 + +- (void)testSendClusterTest_TC_OO_2_2_000000_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send 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); - [cluster readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 64); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000007_Step +- (void)testSendClusterTest_TC_OO_2_2_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step up command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after 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 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 Step up command Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000008_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_2_000002_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send 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 readAttributeCurrentLevelWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 128); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000010_Off +- (void)testSendClusterTest_TC_OO_2_2_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"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 off:^(NSError * err, NSDictionary * values) { - NSLog(@"Sending off command Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"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_LVL_5_1_000000_On +- (void)testSendClusterTest_TC_OO_2_2_000004_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send 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 on:^(NSError * err, NSDictionary * values) { - NSLog(@"Sending on command Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -8579,112 +10428,79 @@ - (void)testSendClusterTest_TC_LVL_5_1_000000_On [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000001_Step +- (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after 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 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); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000002_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - 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 +- (void)testSendClusterTest_TC_OO_2_2_000006_Toggle { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a move up command to DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle 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 moveModeArgument = 0; - uint8_t rateArgument = 1; - 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 to DUT Error: %@", err); - - XCTAssertEqual(err.code, 0); + [cluster toggle:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Toggle Command Error: %@", err); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_5_1_000004_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000005_Stop +- (void)testSendClusterTest_TC_OO_2_2_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends stop command to DUT"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Check on/off attribute value is true after toggle 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 optionMaskArgument = 0; - uint8_t optionOverrideArgument = 0; - [cluster stop:optionMaskArgument - optionOverride:optionOverrideArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Sends stop command to DUT Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is true after toggle command Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 1); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000006_Off +- (void)testSendClusterTest_TC_OO_2_2_000008_Toggle { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle 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); + [cluster toggle:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Toggle Command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -8693,43 +10509,39 @@ - (void)testSendClusterTest_TC_LVL_5_1_000006_Off [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_MC_1_1_000000_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_2_000009_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + [self expectationWithDescription:@"Check on/off attribute value is false after toggle command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t clusterRevisionArgument = 1U; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is false after toggle command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_MC_2_1_000000_Sleep +- (void)testSendClusterTest_TC_OO_2_2_000010_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Put the device into low power mode"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster sleep:^(NSError * err, NSDictionary * values) { - NSLog(@"Put the device into low power mode Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -8738,440 +10550,463 @@ - (void)testSendClusterTest_TC_MC_2_1_000000_Sleep [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OCC_1_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_2_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is true after on command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 2U); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_1_1_000001_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_2_000012_Off { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff 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); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OCC_2_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_2_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads mandatory attribute constrains: Occupancy"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads mandatory attribute constrains: Occupancy Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 1); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000001_WriteAttribute + +- (void)testSendClusterTest_TC_OO_2_3_000000_On { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: Occupancy"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t occupancyArgument = 0; - [cluster writeAttributeOccupancyWithValue:occupancyArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Writes the respective default value to mandatory attribute: Occupancy Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000001_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: Occupancy"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 1000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_3_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads back mandatory attribute: Occupancy Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000003_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorType"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads GlobalSceneControl attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancySensorTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads mandatory attribute constrains: OccupancySensorType Error: %@", err); + [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 3); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000004_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000004_On { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorType"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t occupancySensorTypeArgument = 0; - [cluster writeAttributeOccupancySensorTypeWithValue:occupancySensorTypeArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Writes the respective default value to mandatory attribute: " - @"OccupancySensorType Error: %@", - err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000005_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorType"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 1000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_3_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancySensorTypeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads back mandatory attribute: OccupancySensorType Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000007_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads GlobalSceneControl attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancySensorTypeBitmapWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads mandatory attribute constrains: OccupancySensorTypeBitmap Error: %@", err); + [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertGreaterThanOrEqual([values[@"value"] unsignedCharValue], 1); - XCTAssertLessThanOrEqual([values[@"value"] unsignedCharValue], 7); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000007_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000008_On { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t occupancySensorTypeBitmapArgument = 1; - [cluster writeAttributeOccupancySensorTypeBitmapWithValue:occupancySensorTypeBitmapArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Writes the respective default value to mandatory attribute: " - @"OccupancySensorTypeBitmap Error: %@", - err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000009_WaitForMs { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back mandatory attribute: OccupancySensorTypeBitmap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 1000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_3_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancySensorTypeBitmapWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads back mandatory attribute: OccupancySensorTypeBitmap Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 1); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_OO_2_3_000011_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads GlobalSceneControl attribute from DUT"]; -- (void)testSendClusterTest_TC_OCC_2_2_000000_ReadAttribute + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads GlobalSceneControl attribute from DUT Error: %@", err); + + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 1); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_OO_2_3_000012_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OCC_2_2_000001_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOccupancyWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OO_1_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000014_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send 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 readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 4U); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000001_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000015_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t clusterRevisionArgument = 3U; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + XCTAssertEqual([values[@"value"] boolValue], 1); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000016_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 4U); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000017_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeFeatureMapWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongValue], 0UL); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000004_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000018_Off { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to optional global attribute: FeatureMap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send 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); - uint32_t featureMapArgument = 0UL; - [cluster writeAttributeFeatureMapWithValue:featureMapArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); - XCTAssertEqual(err.code, 1); - [expectation fulfill]; - }]; + XCTAssertEqual(err.code, 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_1_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000019_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back optional global attribute: FeatureMap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeFeatureMapWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedLongValue], 0UL); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OO_2_1_000000_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000020_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: OnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; 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(@"read the mandatory attribute: OnOff Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000021_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back mandatory attribute: OnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9179,7 +11014,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back mandatory attribute: OnOff Error: %@", err); + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9190,38 +11025,38 @@ - (void)testSendClusterTest_TC_OO_2_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000022_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: GlobalSceneControl"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeGlobalSceneControlWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read LT attribute: GlobalSceneControl Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 1); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000023_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OnTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read LT attribute: OnTime Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9232,114 +11067,110 @@ - (void)testSendClusterTest_TC_OO_2_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000024_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: OffWaitTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send 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 readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read LT attribute: OffWaitTime Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000025_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read LT attribute: StartUpOnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeStartUpOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"read LT attribute: StartUpOnOff Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000006_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000026_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OnTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint16_t onTimeArgument = 0U; - [cluster writeAttributeOnTimeWithValue:onTimeArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default value to LT attribute: OnTime Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000007_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000027_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: OffWaitTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send 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); - uint16_t offWaitTimeArgument = 0U; - [cluster writeAttributeOffWaitTimeWithValue:offWaitTimeArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default value to LT attribute: OffWaitTime Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000008_WriteAttribute +- (void)testSendClusterTest_TC_OO_2_3_000028_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"write the default value to LT attribute: StartUpOnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - uint8_t startUpOnOffArgument = 0; - [cluster writeAttributeStartUpOnOffWithValue:startUpOnOffArgument - responseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"write the default value to LT attribute: StartUpOnOff Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); - XCTAssertEqual(err.code, 0); + XCTAssertEqual(err.code, 0); - [expectation fulfill]; - }]; + XCTAssertEqual([values[@"value"] boolValue], 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000029_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OnTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9347,7 +11178,7 @@ - (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back LT attribute: OnTime Error: %@", err); + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9358,60 +11189,59 @@ - (void)testSendClusterTest_TC_OO_2_1_000009_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000030_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: OffWaitTime"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back LT attribute: OffWaitTime Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_1_000011_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000031_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back LT attribute: StartUpOnOff"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeStartUpOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"reads back LT attribute: StartUpOnOff Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] unsignedCharValue], 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_OO_2_2_000000_Off +- (void)testSendClusterTest_TC_OO_2_3_000032_On { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send 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 off:^(NSError * err, NSDictionary * values) { - NSLog(@"Send Off Command Error: %@", err); + [cluster on:^(NSError * err, NSDictionary * values) { + NSLog(@"Send On Command Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9420,9 +11250,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000000_Off [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000001_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000033_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9430,58 +11260,60 @@ - (void)testSendClusterTest_TC_OO_2_2_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 0); + XCTAssertEqual([values[@"value"] boolValue], 1); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000002_On +- (void)testSendClusterTest_TC_OO_2_3_000034_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; 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(@"Send On Command Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000003_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000035_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; 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(@"Check on/off attribute value is true after on command Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 1); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000004_Off +- (void)testSendClusterTest_TC_OO_2_3_000036_Off { XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; @@ -9500,9 +11332,9 @@ - (void)testSendClusterTest_TC_OO_2_2_000004_Off [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000037_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9510,7 +11342,7 @@ - (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); @@ -9521,29 +11353,30 @@ - (void)testSendClusterTest_TC_OO_2_2_000005_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000006_Toggle +- (void)testSendClusterTest_TC_OO_2_3_000038_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster toggle:^(NSError * err, NSDictionary * values) { - NSLog(@"Send Toggle Command Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000007_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000039_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Check on/off attribute value is true after toggle command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -9551,133 +11384,136 @@ - (void)testSendClusterTest_TC_OO_2_2_000007_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is true after toggle command Error: %@", err); + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 1); + XCTAssertEqual([values[@"value"] boolValue], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000008_Toggle +- (void)testSendClusterTest_TC_OO_2_3_000040_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Toggle Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster toggle:^(NSError * err, NSDictionary * values) { - NSLog(@"Send Toggle Command Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000009_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000041_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Check on/off attribute value is false after toggle command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; 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(@"Check on/off attribute value is false after toggle command Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000010_On +- (void)testSendClusterTest_TC_OO_2_3_000042_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send On Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnOff attribute from DUT"]; 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(@"Send On Command Error: %@", err); + [cluster readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnOff attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] boolValue], 0); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000011_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000043_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is true after on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OnTime attribute from DUT"]; 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(@"Check on/off attribute value is true after on command Error: %@", err); + [cluster readAttributeOnTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OnTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 1); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000012_Off +- (void)testSendClusterTest_TC_OO_2_3_000044_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Send Off Command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads OffWaitTime attribute from DUT"]; 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(@"Send Off Command Error: %@", err); + [cluster readAttributeOffWaitTimeWithResponseHandler:^(NSError * err, NSDictionary * values) { + NSLog(@"Reads OffWaitTime attribute from DUT Error: %@", err); XCTAssertEqual(err.code, 0); + XCTAssertEqual([values[@"value"] unsignedShortValue], 0U); + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_OO_2_2_000013_ReadAttribute +- (void)testSendClusterTest_TC_OO_2_3_000045_Off { - XCTestExpectation * expectation = [self expectationWithDescription:@"Check on/off attribute value is false after off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Send 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 readAttributeOnOffWithResponseHandler:^(NSError * err, NSDictionary * values) { - NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + [cluster off:^(NSError * err, NSDictionary * values) { + NSLog(@"Send Off Command Error: %@", err); XCTAssertEqual(err.code, 0); - XCTAssertEqual([values[@"value"] boolValue], 0); - [expectation fulfill]; }]; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index c216cdf192b978..6a2ef2baa4ec1c 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -10122,10 +10122,10 @@ class Test_TC_CC_8_1 : public TestCommand } }; -class Test_TC_CC_9_2 : public TestCommand +class Test_TC_CC_9_1 : public TestCommand { public: - Test_TC_CC_9_2() : TestCommand("Test_TC_CC_9_2"), mTestIndex(0) {} + Test_TC_CC_9_1() : TestCommand("Test_TC_CC_9_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -10134,12 +10134,12 @@ class Test_TC_CC_9_2 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -10153,12 +10153,12 @@ class Test_TC_CC_9_2 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Precondition: Turn on light for color control tests\n"); + 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 : Precondition: Check on/off attribute value is true after on command\n"); - err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Check on/off attribute value is true after on command\n"); + err = TestCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Sends ColorLoopSet Command - Set all Attributes\n"); @@ -10169,44 +10169,132 @@ class Test_TC_CC_9_2 : public TestCommand err = TestReadColorLoopActiveAttributeFromDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read ColorLoopDirection attribute from DUT.\n"); - err = TestReadColorLoopDirectionAttributeFromDut_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopTime attribute from DUT.\n"); - err = TestReadColorLoopTimeAttributeFromDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); - err = TestReadColorLoopStartEnhancedHueAttributeFromDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Color Loop Set Command - Set all Attributes\n"); - err = TestColorLoopSetCommandSetAllAttributes_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Read ColorLoopTime attribute from DUT\n"); + err = TestReadColorLoopTimeAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopActive attribute from DUT.\n"); - err = TestReadColorLoopActiveAttributeFromDut_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Start Color Loop\n"); - err = TestColorLoopSetCommandStartColorLoop_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Read ColorLoopStartEnhancedHue attribute from DUT\n"); + err = TestReadColorLoopStartEnhancedHueAttributeFromDut_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopDirection attribute from DUT.\n"); - err = TestReadColorLoopDirectionAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Color Loop Set Command - Start Color Loop\n"); - err = TestColorLoopSetCommandStartColorLoop_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopActive attribute from DUT\n"); - err = TestReadColorLoopActiveAttributeFromDut_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Turn off light for color control tests\n"); - err = TestTurnOffLightForColorControlTests_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Enhanced Move To Hue command 10\n"); + err = TestEnhancedMoveToHueCommand10_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Wait 2000ms\n"); + err = TestWait2000ms_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : Sends ColorLoopSet Command - Set all Attributes\n"); + err = TestSendsColorLoopSetCommandSetAllAttributes_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : Turn Off light for color control tests\n"); + err = TestTurnOffLightForColorControlTests_35(); break; } @@ -10219,107 +10307,218 @@ class Test_TC_CC_9_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + const uint16_t mTestCount = 36; 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_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_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_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, + 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 }; + chip::Callback::Callback mOnFailureCallback_15{ OnFailureCallback_15, this }; + chip::Callback::Callback mOnSuccessCallback_15{ OnSuccessCallback_15, this }; - chip::Callback::Callback mOnFailureCallback_12{ OnFailureCallback_12, this }; - chip::Callback::Callback mOnSuccessCallback_12{ OnSuccessCallback_12, this }; + chip::Callback::Callback mOnFailureCallback_17{ OnFailureCallback_17, this }; + chip::Callback::Callback mOnSuccessCallback_17{ OnSuccessCallback_17, this }; + chip::Callback::Callback mOnFailureCallback_19{ OnFailureCallback_19, this }; + chip::Callback::Callback mOnSuccessCallback_19{ OnSuccessCallback_19, this }; + chip::Callback::Callback mOnFailureCallback_22{ OnFailureCallback_22, this }; + chip::Callback::Callback mOnSuccessCallback_22{ OnSuccessCallback_22, + this }; + chip::Callback::Callback mOnFailureCallback_24{ OnFailureCallback_24, this }; + chip::Callback::Callback mOnSuccessCallback_24{ OnSuccessCallback_24, + this }; + chip::Callback::Callback mOnFailureCallback_26{ OnFailureCallback_26, this }; + chip::Callback::Callback mOnSuccessCallback_26{ OnSuccessCallback_26, this }; + chip::Callback::Callback mOnFailureCallback_28{ OnFailureCallback_28, this }; + chip::Callback::Callback mOnSuccessCallback_28{ OnSuccessCallback_28, this }; + chip::Callback::Callback mOnFailureCallback_30{ OnFailureCallback_30, this }; + chip::Callback::Callback mOnSuccessCallback_30{ OnSuccessCallback_30, + this }; + chip::Callback::Callback mOnFailureCallback_32{ OnFailureCallback_32, this }; + chip::Callback::Callback mOnSuccessCallback_32{ OnSuccessCallback_32, this }; + chip::Callback::Callback mOnFailureCallback_34{ OnFailureCallback_34, this }; + chip::Callback::Callback mOnSuccessCallback_34{ OnSuccessCallback_34, this }; 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_cast(context))->OnSuccessResponse_1(onOff); + (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, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_3(colorLoopActive); + (static_cast(context))->OnSuccessResponse_3(colorLoopActive); } - static void OnFailureCallback_4(void * context, uint8_t status) + static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_5(status); } - static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) + static void OnSuccessCallback_5(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); + (static_cast(context))->OnSuccessResponse_5(colorLoopDirection); } - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnFailureCallback_7(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_7(status); } - static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) + static void OnSuccessCallback_7(void * context, uint16_t colorLoopTime) { - (static_cast(context))->OnSuccessResponse_5(colorLoopTime); + (static_cast(context))->OnSuccessResponse_7(colorLoopTime); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnFailureCallback_9(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_9(status); } - static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) + static void OnSuccessCallback_9(void * context, uint16_t colorLoopStartEnhancedHue) { - (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); + (static_cast(context))->OnSuccessResponse_9(colorLoopStartEnhancedHue); } - static void OnFailureCallback_8(void * context, uint8_t status) + static void OnFailureCallback_11(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_11(status); } - static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) + static void OnSuccessCallback_11(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_8(colorLoopActive); + (static_cast(context))->OnSuccessResponse_11(colorLoopActive); } - static void OnFailureCallback_10(void * context, uint8_t status) + static void OnFailureCallback_13(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_13(status); } - static void OnSuccessCallback_10(void * context, uint8_t colorLoopDirection) + static void OnSuccessCallback_13(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_10(colorLoopDirection); + (static_cast(context))->OnSuccessResponse_13(colorLoopActive); } - static void OnFailureCallback_12(void * context, uint8_t status) + static void OnFailureCallback_15(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_12(status); + (static_cast(context))->OnFailureResponse_15(status); } - static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) + static void OnSuccessCallback_15(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_12(colorLoopActive); + (static_cast(context))->OnSuccessResponse_15(colorLoopDirection); + } + + static void OnFailureCallback_17(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_17(status); + } + + static void OnSuccessCallback_17(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_17(colorLoopActive); + } + + static void OnFailureCallback_19(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_19(status); + } + + static void OnSuccessCallback_19(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_19(colorLoopActive); + } + + static void OnFailureCallback_22(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_22(status); + } + + static void OnSuccessCallback_22(void * context, uint16_t enhancedCurrentHue) + { + (static_cast(context))->OnSuccessResponse_22(enhancedCurrentHue); + } + + static void OnFailureCallback_24(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_24(status); + } + + static void OnSuccessCallback_24(void * context, uint8_t colorLoopDirection) + { + (static_cast(context))->OnSuccessResponse_24(colorLoopDirection); + } + + static void OnFailureCallback_26(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_26(status); + } + + static void OnSuccessCallback_26(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_26(colorLoopActive); + } + + static void OnFailureCallback_28(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_28(status); + } + + static void OnSuccessCallback_28(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_28(colorLoopActive); + } + + static void OnFailureCallback_30(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_30(status); + } + + static void OnSuccessCallback_30(void * context, uint8_t colorLoopDirection) + { + (static_cast(context))->OnSuccessResponse_30(colorLoopDirection); + } + + static void OnFailureCallback_32(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_32(status); + } + + static void OnSuccessCallback_32(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_32(colorLoopActive); + } + + static void OnFailureCallback_34(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_34(status); + } + + static void OnSuccessCallback_34(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_34(colorLoopActive); } // @@ -10337,11 +10536,11 @@ class Test_TC_CC_9_2 : public TestCommand chip::app::Clusters::OnOff::Commands::On::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); + (static_cast(context))->OnSuccessResponse_0(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_0(status); }; return cluster.InvokeCommand(request, this, success, failure); } @@ -10350,7 +10549,7 @@ class Test_TC_CC_9_2 : public TestCommand void OnSuccessResponse_0() { NextTest(); } - CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_1() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10375,20 +10574,20 @@ class Test_TC_CC_9_2 : public TestCommand using responseType = chip::app::DataModel::NullObjectType; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = static_cast>(15); + request.updateFlags = static_cast>(1); request.action = static_cast(0); request.direction = static_cast(0); - request.time = 30U; - request.startHue = 160U; + request.time = 0U; + request.startHue = 0U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_2(); + (static_cast(context))->OnSuccessResponse_2(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_2(status); }; return cluster.InvokeCommand(request, this, success, failure); } @@ -10413,55 +10612,101 @@ class Test_TC_CC_9_2 : public TestCommand NextTest(); } - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_4() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_4() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.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(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 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(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - NextTest(); - } + void OnSuccessResponse_4() { NextTest(); } - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_5() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_5() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint16_t colorLoopTime) + void OnSuccessResponse_5(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); NextTest(); } - CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_6() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_6() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); - } - - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) + 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 = 30U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; + + 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 TestReadColorLoopTimeAttributeFromDut_7() { - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(uint16_t colorLoopTime) + { + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_7() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_8() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10470,45 +10715,45 @@ class Test_TC_CC_9_2 : public TestCommand 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.updateFlags = static_cast>(8); + request.action = static_cast(0); request.direction = static_cast(0); request.time = 0U; - request.startHue = 0U; + request.startHue = 160U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_7(); + (static_cast(context))->OnSuccessResponse_8(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_8(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7() { NextTest(); } + void OnSuccessResponse_8() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_8() + CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_9() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint8_t colorLoopActive) + void OnSuccessResponse_9(uint16_t colorLoopStartEnhancedHue) { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_9() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_10() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10517,45 +10762,45 @@ class Test_TC_CC_9_2 : public TestCommand 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.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_9(); + (static_cast(context))->OnSuccessResponse_10(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_10(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9() { NextTest(); } + void OnSuccessResponse_10() { NextTest(); } - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_10() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_11() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint8_t colorLoopDirection) + void OnSuccessResponse_11(uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_11() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_12() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10573,304 +10818,224 @@ class Test_TC_CC_9_2 : public TestCommand request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_11(); + (static_cast(context))->OnSuccessResponse_12(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); + (static_cast(context))->OnFailureResponse_12(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11() { NextTest(); } + void OnSuccessResponse_12() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_13() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); } - void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_12(uint8_t colorLoopActive) + void OnSuccessResponse_13(uint8_t colorLoopActive) { VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestTurnOffLightForColorControlTests_13() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_14() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; using responseType = chip::app::DataModel::NullObjectType; - chip::app::Clusters::OnOff::Commands::Off::Type request; + 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_13(); + (static_cast(context))->OnSuccessResponse_14(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_13(status); + (static_cast(context))->OnFailureResponse_14(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_14(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_13() { NextTest(); } -}; + void OnSuccessResponse_14() { NextTest(); } -class Test_TC_CC_9_3 : public TestCommand -{ -public: - Test_TC_CC_9_3() : TestCommand("Test_TC_CC_9_3"), mTestIndex(0) {} + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_15() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - /////////// TestCommand Interface ///////// - void NextTest() override + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); + } + + void OnFailureResponse_15(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_15(uint8_t colorLoopDirection) { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); + NextTest(); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_3\n"); - } + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_16() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_3\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>(1); + request.action = static_cast(1); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + 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 : Precondition: Turn on light for color control tests\n"); - err = TestPreconditionTurnOnLightForColorControlTests_0(); - break; - case 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 : 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; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_16(); + }; - 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_16(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + void OnFailureResponse_16(uint8_t status) { ThrowFailureResponse(); } - 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_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 }; + void OnSuccessResponse_16() { NextTest(); } - static void OnFailureCallback_1(void * context, uint8_t status) + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_17() { - (static_cast(context))->OnFailureResponse_1(status); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_1(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_1(onOff); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); } - static void OnFailureCallback_3(void * context, uint8_t status) + void OnFailureResponse_17(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_17(uint8_t colorLoopActive) { - (static_cast(context))->OnFailureResponse_3(status); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); + NextTest(); } - static void OnSuccessCallback_3(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_3(colorLoopActive); - } - - static void OnFailureCallback_4(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_4(status); - } - - static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_18() { - (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_5(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_5(status); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) - { - (static_cast(context))->OnSuccessResponse_5(colorLoopTime); - } + 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; - static void OnFailureCallback_6(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_6(status); - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_18(); + }; - static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) - { - (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_18(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnFailureCallback_8(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_8(status); - } + void OnFailureResponse_18(uint8_t status) { ThrowFailureResponse(); } - static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) - { - (static_cast(context))->OnSuccessResponse_8(colorLoopActive); - } + void OnSuccessResponse_18() { NextTest(); } - static void OnFailureCallback_10(void * context, uint8_t status) + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_19() { - (static_cast(context))->OnFailureResponse_10(status); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_10(void * context, uint16_t colorLoopTime) - { - (static_cast(context))->OnSuccessResponse_10(colorLoopTime); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_19.Cancel(), mOnFailureCallback_19.Cancel()); } - static void OnFailureCallback_12(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_12(status); - } + void OnFailureResponse_19(uint8_t status) { ThrowFailureResponse(); } - static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) + void OnSuccessResponse_19(uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_12(colorLoopActive); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); + NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_0() + CHIP_ERROR TestEnhancedMoveToHueCommand10_20() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using requestType = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type; using responseType = chip::app::DataModel::NullObjectType; - chip::app::Clusters::OnOff::Commands::On::Type request; + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type request; + request.enhancedHue = 40960U; + request.direction = static_cast(0); + request.transitionTime = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); + (static_cast(context))->OnSuccessResponse_20(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_20(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_20(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0() { NextTest(); } + void OnSuccessResponse_20() { NextTest(); } - CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() + CHIP_ERROR TestWait2000ms_21() { return WaitForMs(2000); } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_22() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeEnhancedCurrentHue(mOnSuccessCallback_22.Cancel(), mOnFailureCallback_22.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_22(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(bool onOff) + void OnSuccessResponse_22(uint16_t enhancedCurrentHue) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, 40960U)); NextTest(); } - CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_2() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_23() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10879,93 +11044,139 @@ class Test_TC_CC_9_3 : public TestCommand using responseType = chip::app::DataModel::NullObjectType; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = static_cast>(15); + request.updateFlags = static_cast>(2); request.action = static_cast(0); request.direction = static_cast(0); - request.time = 30U; - request.startHue = 160U; + request.time = 0U; + request.startHue = 0U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_2(); + (static_cast(context))->OnSuccessResponse_23(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_23(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_23(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2() { NextTest(); } + void OnSuccessResponse_23() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_3() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_24() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_24.Cancel(), mOnFailureCallback_24.Cancel()); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_24(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint8_t colorLoopActive) + void OnSuccessResponse_24(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); NextTest(); } - CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_4() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_25() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; + request.updateFlags = static_cast>(1); + request.action = static_cast(2); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + request.optionsMask = 0; + request.optionsOverride = 0; - void OnSuccessResponse_4(uint8_t colorLoopDirection) - { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - NextTest(); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_25(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_25(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_5() + void OnFailureResponse_25(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_25() { NextTest(); } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_26() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_26.Cancel(), mOnFailureCallback_26.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_26(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint16_t colorLoopTime) + void OnSuccessResponse_26(uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_6() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_27() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.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(0); + 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_27(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_27(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_27(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) + void OnSuccessResponse_27() { NextTest(); } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_28() { - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_28.Cancel(), mOnFailureCallback_28.Cancel()); + } + + void OnFailureResponse_28(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_28(uint8_t colorLoopActive) + { + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_7() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_29() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -10974,45 +11185,45 @@ class Test_TC_CC_9_3 : public TestCommand 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.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_7(); + (static_cast(context))->OnSuccessResponse_29(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_29(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_29(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7() { NextTest(); } + void OnSuccessResponse_29() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_8() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_30() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_30.Cancel(), mOnFailureCallback_30.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_30(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint8_t colorLoopActive) + void OnSuccessResponse_30(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 1)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_9() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_31() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -11021,45 +11232,45 @@ class Test_TC_CC_9_3 : public TestCommand using responseType = chip::app::DataModel::NullObjectType; chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type request; - request.updateFlags = static_cast>(4); - request.action = static_cast(0); + request.updateFlags = static_cast>(1); + request.action = static_cast(2); request.direction = static_cast(0); - request.time = 60U; + request.time = 0U; request.startHue = 0U; request.optionsMask = 0; request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_9(); + (static_cast(context))->OnSuccessResponse_31(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_31(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_31(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9() { NextTest(); } + void OnSuccessResponse_31() { NextTest(); } - CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_10() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_32() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_32.Cancel(), mOnFailureCallback_32.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_32(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint16_t colorLoopTime) + void OnSuccessResponse_32(uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 60U)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestColorLoopSetCommandStartColorLoop_11() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_33() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); @@ -11077,36 +11288,36 @@ class Test_TC_CC_9_3 : public TestCommand request.optionsOverride = 0; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_11(); + (static_cast(context))->OnSuccessResponse_33(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); + (static_cast(context))->OnFailureResponse_33(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_33(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11() { NextTest(); } + void OnSuccessResponse_33() { NextTest(); } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_34() { chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_34.Cancel(), mOnFailureCallback_34.Cancel()); } - void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_34(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_12(uint8_t colorLoopActive) + void OnSuccessResponse_34(uint8_t colorLoopActive) { VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestTurnOffLightForColorControlTests_13() + CHIP_ERROR TestTurnOffLightForColorControlTests_35() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); @@ -11117,24 +11328,24 @@ class Test_TC_CC_9_3 : public TestCommand chip::app::Clusters::OnOff::Commands::Off::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_13(); + (static_cast(context))->OnSuccessResponse_35(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_13(status); + (static_cast(context))->OnFailureResponse_35(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_35(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_13() { NextTest(); } + void OnSuccessResponse_35() { NextTest(); } }; -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 @@ -11143,12 +11354,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; } @@ -11162,76 +11373,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; } @@ -11244,574 +11439,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_cast(context))->OnFailureResponse_6(status); } - static void OnSuccessCallback_6(void * context, chip::CharSpan location) + static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) { - (static_cast(context))->OnSuccessResponse_6(location); + (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); } - static void OnFailureCallback_7(void * context, uint8_t status) + static void OnFailureCallback_8(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_8(status); } - static void OnSuccessCallback_7(void * context, uint16_t hardwareVersion) + static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_7(hardwareVersion); + (static_cast(context))->OnSuccessResponse_8(colorLoopActive); } - static void OnFailureCallback_8(void * context, uint8_t status) + static void OnFailureCallback_10(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_8(void * context, chip::CharSpan hardwareVersionString) + static void OnSuccessCallback_10(void * context, uint8_t colorLoopDirection) { - (static_cast(context))->OnSuccessResponse_8(hardwareVersionString); + (static_cast(context))->OnSuccessResponse_10(colorLoopDirection); } - static void OnFailureCallback_9(void * context, uint8_t status) + static void OnFailureCallback_12(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_12(status); } - static void OnSuccessCallback_9(void * context, uint32_t softwareVersion) + static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_9(softwareVersion); + (static_cast(context))->OnSuccessResponse_12(colorLoopActive); } - static void OnFailureCallback_10(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_10(status); - } + // + // Tests methods + // - static void OnSuccessCallback_10(void * context, chip::CharSpan softwareVersionString) + CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_0() { - (static_cast(context))->OnSuccessResponse_10(softwareVersionString); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_11(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_11(status); - } + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; - static void OnSuccessCallback_11(void * context, chip::CharSpan manufacturingDate) - { - (static_cast(context))->OnSuccessResponse_11(manufacturingDate); - } + chip::app::Clusters::OnOff::Commands::On::Type request; - static void OnFailureCallback_12(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_12(status); + 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_12(void * context, chip::CharSpan partNumber) + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() { - (static_cast(context))->OnSuccessResponse_12(partNumber); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - static void OnFailureCallback_13(void * context, uint8_t status) + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(bool onOff) { - (static_cast(context))->OnFailureResponse_13(status); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); } - static void OnSuccessCallback_13(void * context, chip::CharSpan productURL) + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_2() { - (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); - } - - static void OnFailureCallback_16(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_16(status); - } - - static void OnSuccessCallback_16(void * context, bool localConfigDisabled) - { - (static_cast(context))->OnSuccessResponse_16(localConfigDisabled); - } - - static void OnFailureCallback_17(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_17(status); - } - - static void OnSuccessCallback_17(void * context, bool reachable) - { - (static_cast(context))->OnSuccessResponse_17(reachable); - } - - // - // Tests methods - // - - CHIP_ERROR TestQueryInteractionModelVersion_0() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeInteractionModelVersion(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); - } - - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint16_t interactionModelVersion) - { - VerifyOrReturn(CheckConstraintType("interactionModelVersion", "", "uint16")); - NextTest(); - } - - CHIP_ERROR TestQueryVendorName_1() - { - 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()); - } - - 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()); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnFailureResponse_13(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_13(chip::CharSpan productURL) - { - VerifyOrReturn(CheckConstraintType("productURL", "", "string")); - VerifyOrReturn(CheckConstraintFormat("productURL", "", "RFC3986")); - VerifyOrReturn(CheckConstraintMaxLength("productURL", productURL.size(), 256)); - 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 TestQueryProductLabel_14() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; - return cluster.ReadAttributeProductLabel(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel()); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_14(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_14(chip::CharSpan productLabel) - { - VerifyOrReturn(CheckConstraintType("productLabel", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("productLabel", productLabel.size(), 64)); - NextTest(); - } + void OnSuccessResponse_11() { NextTest(); } - CHIP_ERROR TestQuerySerialNumber_15() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSerialNumber(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); } - void OnFailureResponse_15(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_15(chip::CharSpan serialNumber) + void OnSuccessResponse_12(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("serialNumber", "", "string")); - VerifyOrReturn(CheckConstraintMaxLength("serialNumber", serialNumber.size(), 32)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestQueryLocalConfigDisabled_16() + CHIP_ERROR TestTurnOffLightForColorControlTests_13() { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); - - return cluster.ReadAttributeLocalConfigDisabled(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel()); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnFailureResponse_16(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnSuccessResponse_16(bool localConfigDisabled) - { - VerifyOrReturn(CheckConstraintType("localConfigDisabled", "", "boolean")); - NextTest(); - } + chip::app::Clusters::OnOff::Commands::Off::Type request; - CHIP_ERROR TestQueryReachable_17() - { - chip::Controller::BasicClusterTest cluster; - cluster.Associate(mDevice, 0); + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; - return cluster.ReadAttributeReachable(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_17(uint8_t status) - { - (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); - } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_17(bool reachable) - { - VerifyOrReturn(CheckConstraintType("reachable", "", "boolean")); - NextTest(); - } + void OnSuccessResponse_13() { NextTest(); } }; -class Test_TC_DM_3_1 : public TestCommand +class Test_TC_CC_9_3 : public TestCommand { public: - Test_TC_DM_3_1() : TestCommand("Test_TC_DM_3_1"), mTestIndex(0) {} + Test_TC_CC_9_3() : TestCommand("Test_TC_CC_9_3"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -11820,12 +11859,12 @@ class Test_TC_DM_3_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CC_9_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CC_9_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -11838,6 +11877,62 @@ class Test_TC_DM_3_1 : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 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 : Precondition: Check on/off attribute value is true after on command\n"); + err = TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1(); + break; + case 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; } if (CHIP_NO_ERROR != err) @@ -11849,423 +11944,417 @@ class Test_TC_DM_3_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; - - // - // Tests methods - // -}; + const uint16_t mTestCount = 14; -class Test_TC_DM_2_2 : public TestCommand -{ -public: - Test_TC_DM_2_2() : TestCommand("Test_TC_DM_2_2"), mTestIndex(0) {} + 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_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 }; - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnFailureCallback_1(void * context, uint8_t status) { - CHIP_ERROR err = CHIP_NO_ERROR; + (static_cast(context))->OnFailureResponse_1(status); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_2_2\n"); - } + static void OnSuccessCallback_1(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_1(onOff); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } - Wait(); + static void OnSuccessCallback_3(void * context, uint8_t colorLoopActive) + { + (static_cast(context))->OnSuccessResponse_3(colorLoopActive); + } - // 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 : Query fabrics list\n"); - err = TestQueryFabricsList_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Query Supported Fabrics\n"); - err = TestQuerySupportedFabrics_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Query Commissioned Fabrics\n"); - err = TestQueryCommissionedFabrics_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Query User Trusted Root Certificates\n"); - err = TestQueryUserTrustedRootCertificates_3(); - break; - } + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnSuccessCallback_4(void * context, uint8_t colorLoopDirection) + { + (static_cast(context))->OnSuccessResponse_4(colorLoopDirection); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback & fabricsList)> - 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 & trustedRootCertificates)> - mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + static void OnSuccessCallback_5(void * context, uint16_t colorLoopTime) + { + (static_cast(context))->OnSuccessResponse_5(colorLoopTime); + } - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_6(status); } - static void - OnSuccessCallback_0(void * context, - const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabricsList) + static void OnSuccessCallback_6(void * context, uint16_t colorLoopStartEnhancedHue) { - (static_cast(context))->OnSuccessResponse_0(fabricsList); + (static_cast(context))->OnSuccessResponse_6(colorLoopStartEnhancedHue); } - static void OnFailureCallback_1(void * context, uint8_t status) + static void OnFailureCallback_8(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_8(status); } - static void OnSuccessCallback_1(void * context, uint8_t supportedFabrics) + static void OnSuccessCallback_8(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_1(supportedFabrics); + (static_cast(context))->OnSuccessResponse_8(colorLoopActive); } - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_10(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_2(void * context, uint8_t commissionedFabrics) + static void OnSuccessCallback_10(void * context, uint16_t colorLoopTime) { - (static_cast(context))->OnSuccessResponse_2(commissionedFabrics); + (static_cast(context))->OnSuccessResponse_10(colorLoopTime); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnFailureCallback_12(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_12(status); } - static void OnSuccessCallback_3(void * context, - const chip::app::DataModel::DecodableList & trustedRootCertificates) + static void OnSuccessCallback_12(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_3(trustedRootCertificates); + (static_cast(context))->OnSuccessResponse_12(colorLoopActive); } // // Tests methods // - CHIP_ERROR TestQueryFabricsList_0() + CHIP_ERROR TestPreconditionTurnOnLightForColorControlTests_0() { - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeFabricsList(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + 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(const chip::app::DataModel::DecodableList< - chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabricsList) - { - VerifyOrReturn(CheckValueAsListLength("fabricsList", fabricsList, 1)); - NextTest(); - } + void OnSuccessResponse_0() { NextTest(); } - CHIP_ERROR TestQuerySupportedFabrics_1() + CHIP_ERROR TestPreconditionCheckOnOffAttributeValueIsTrueAfterOnCommand_1() { - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeSupportedFabrics(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(uint8_t supportedFabrics) + void OnSuccessResponse_1(bool onOff) { - VerifyOrReturn(CheckValue("supportedFabrics", supportedFabrics, 16)); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestQueryCommissionedFabrics_2() + CHIP_ERROR TestSendsColorLoopSetCommandSetAllAttributes_2() { - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCommissionedFabrics(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.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>(15); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 30U; + request.startHue = 160U; + request.optionsMask = 0; + request.optionsOverride = 0; + + 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(uint8_t commissionedFabrics) + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_3() { - VerifyOrReturn(CheckValue("commissionedFabrics", commissionedFabrics, 1)); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t colorLoopActive) + { + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); NextTest(); } - CHIP_ERROR TestQueryUserTrustedRootCertificates_3() + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_4() { - chip::Controller::OperationalCredentialsClusterTest cluster; - cluster.Associate(mDevice, 0); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - return cluster.ReadAttributeTrustedRootCertificates(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeColorLoopDirection(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & trustedRootCertificates) + void OnSuccessResponse_4(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckValueAsListLength("trustedRootCertificates", trustedRootCertificates, 1)); + VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); NextTest(); } -}; -class Test_TC_EMR_1_1 : public TestCommand -{ -public: - Test_TC_EMR_1_1() : TestCommand("Test_TC_EMR_1_1"), mTestIndex(0) {} + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_5() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - /////////// TestCommand Interface ///////// - void NextTest() override + return cluster.ReadAttributeColorLoopTime(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint16_t colorLoopTime) { - CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 30U)); + NextTest(); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_EMR_1_1\n"); - } + CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_6() + { + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EMR_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + return cluster.ReadAttributeColorLoopStartEnhancedHue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } - Wait(); + void OnFailureResponse_6(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 : 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_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, this }; - - static void OnFailureCallback_0(void * context, uint8_t status) + void OnSuccessResponse_6(uint16_t colorLoopStartEnhancedHue) { - (static_cast(context))->OnFailureResponse_0(status); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 160U)); + NextTest(); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_7() { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnFailureCallback_1(void * context, EmberAfStatus status) - { - (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); - } + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + 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_2(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_2(status); - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + 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 TestReadTheGlobalAttributeClusterRevision_0() + void OnSuccessResponse_7() { NextTest(); } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_8() { - chip::Controller::ElectricalMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(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(uint16_t clusterRevision) + void OnSuccessResponse_8(uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + CHIP_ERROR TestColorLoopSetCommandStartColorLoop_9() { - chip::Controller::ElectricalMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; + using requestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + 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; + + 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_1(uint8_t status) { NextTest(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1() { ThrowSuccessResponse(); } + void OnSuccessResponse_9() { NextTest(); } - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_10() { - chip::Controller::ElectricalMeasurementClusterTest cluster; + chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(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(uint16_t clusterRevision) + void OnSuccessResponse_10(uint16_t colorLoopTime) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); + VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 60U)); 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 TestColorLoopSetCommandStartColorLoop_11() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_1_1\n"); - } + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_1_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>(1); + request.action = static_cast(0); + request.direction = static_cast(0); + request.time = 0U; + request.startHue = 0U; + 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 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0(); - break; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; - 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_11(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_0(void * context, EmberAfStatus status) + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_12() { - (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeColorLoopActive(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); } - static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_12(uint8_t colorLoopActive) + { + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); + NextTest(); + } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + CHIP_ERROR TestTurnOffLightForColorControlTests_13() { - chip::Controller::FlowMeasurementClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 2U; + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0() { ThrowSuccessResponse(); } + void OnSuccessResponse_13() { NextTest(); } }; -class Test_TC_FLW_2_1 : public TestCommand +class Test_TC_DM_1_1 : public TestCommand { public: - Test_TC_FLW_2_1() : TestCommand("Test_TC_FLW_2_1"), mTestIndex(0) {} + Test_TC_DM_1_1() : TestCommand("Test_TC_DM_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -12274,12 +12363,12 @@ class Test_TC_FLW_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -12293,36 +12382,76 @@ class Test_TC_FLW_2_1 : 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: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Query Vendor Name\n"); + err = TestQueryVendorName_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Query VendorID\n"); + err = TestQueryVendorID_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : write the default value to optional attribute: MinMeasuredValue\n"); - err = TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Query Product Name\n"); + err = TestQueryProductName_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : write the default value to optional attribute: MaxMeasuredValue\n"); - err = TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Query ProductID\n"); + err = TestQueryProductID_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Query User Label\n"); + err = TestQueryUserLabel_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: MinMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMinMeasuredValue_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Query User Location\n"); + err = TestQueryUserLocation_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MaxMeasuredValue\n"); - err = TestReadTheMandatoryAttributeMaxMeasuredValue_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Query HardwareVersion\n"); + err = TestQueryHardwareVersion_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Query HardwareVersionString\n"); + err = TestQueryHardwareVersionString_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Query SoftwareVersion\n"); + err = TestQuerySoftwareVersion_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Query SoftwareVersionString\n"); + err = TestQuerySoftwareVersionString_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Query ManufacturingDate\n"); + err = TestQueryManufacturingDate_11(); + break; + case 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; } @@ -12335,783 +12464,811 @@ class Test_TC_FLW_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + 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 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 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 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 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, int16_t measuredValue) + static void OnSuccessCallback_0(void * context, uint16_t interactionModelVersion) { - (static_cast(context))->OnSuccessResponse_0(measuredValue); + (static_cast(context))->OnSuccessResponse_0(interactionModelVersion); } 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, int16_t minMeasuredValue) + static void OnSuccessCallback_1(void * context, chip::CharSpan vendorName) { - (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); + (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_2(status); } - static void OnSuccessCallback_2(void * context, int16_t maxMeasuredValue) + static void OnSuccessCallback_2(void * context, uint16_t vendorID) { - (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); + (static_cast(context))->OnSuccessResponse_2(vendorID); } - static void OnFailureCallback_3(void * context, EmberAfStatus status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + static void OnSuccessCallback_3(void * context, chip::CharSpan productName) + { + (static_cast(context))->OnSuccessResponse_3(productName); + } - static void OnFailureCallback_4(void * context, EmberAfStatus status) + static void OnFailureCallback_4(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } + static void OnSuccessCallback_4(void * context, uint16_t productID) + { + (static_cast(context))->OnSuccessResponse_4(productID); + } 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, int16_t measuredValue) + static void OnSuccessCallback_5(void * context, chip::CharSpan userLabel) { - (static_cast(context))->OnSuccessResponse_5(measuredValue); + (static_cast(context))->OnSuccessResponse_5(userLabel); } 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, int16_t minMeasuredValue) + static void OnSuccessCallback_6(void * context, chip::CharSpan location) { - (static_cast(context))->OnSuccessResponse_6(minMeasuredValue); + (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_7(status); } - static void OnSuccessCallback_7(void * context, int16_t maxMeasuredValue) + static void OnSuccessCallback_7(void * context, uint16_t hardwareVersion) { - (static_cast(context))->OnSuccessResponse_7(maxMeasuredValue); + (static_cast(context))->OnSuccessResponse_7(hardwareVersion); } - // - // Tests methods - // + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() + static void OnSuccessCallback_8(void * context, chip::CharSpan hardwareVersionString) { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_8(hardwareVersionString); + } - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + static void OnFailureCallback_9(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_9(status); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_9(void * context, uint32_t softwareVersion) + { + (static_cast(context))->OnSuccessResponse_9(softwareVersion); + } - void OnSuccessResponse_0(int16_t measuredValue) + static void OnFailureCallback_10(void * context, uint8_t status) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); + (static_cast(context))->OnFailureResponse_10(status); } - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() + static void OnSuccessCallback_10(void * context, chip::CharSpan softwareVersionString) { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_10(softwareVersionString); + } - return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + static void OnFailureCallback_11(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_11(status); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_11(void * context, chip::CharSpan manufacturingDate) + { + (static_cast(context))->OnSuccessResponse_11(manufacturingDate); + } - void OnSuccessResponse_1(int16_t minMeasuredValue) + static void OnFailureCallback_12(void * context, uint8_t status) { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); - NextTest(); + (static_cast(context))->OnFailureResponse_12(status); } - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() + static void OnSuccessCallback_12(void * context, chip::CharSpan partNumber) { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_12(partNumber); + } - return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + static void OnFailureCallback_13(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_13(status); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_13(void * context, chip::CharSpan productURL) + { + (static_cast(context))->OnSuccessResponse_13(productURL); + } - void OnSuccessResponse_2(int16_t maxMeasuredValue) + static void OnFailureCallback_14(void * context, uint8_t status) { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); - NextTest(); + (static_cast(context))->OnFailureResponse_14(status); } - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3() + static void OnSuccessCallback_14(void * context, chip::CharSpan productLabel) { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_14(productLabel); + } - int16_t minMeasuredValueArgument; - minMeasuredValueArgument = 0; + static void OnFailureCallback_15(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_15(status); + } - return cluster.WriteAttribute( - minMeasuredValueArgument, this, OnSuccessCallback_3, OnFailureCallback_3); + static void OnSuccessCallback_15(void * context, chip::CharSpan serialNumber) + { + (static_cast(context))->OnSuccessResponse_15(serialNumber); } - void OnFailureResponse_3(uint8_t status) { NextTest(); } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4() + static void OnFailureCallback_16(void * context, uint8_t status) { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_16(status); + } - int16_t maxMeasuredValueArgument; - maxMeasuredValueArgument = 0; + static void OnSuccessCallback_16(void * context, bool localConfigDisabled) + { + (static_cast(context))->OnSuccessResponse_16(localConfigDisabled); + } - return cluster.WriteAttribute( - maxMeasuredValueArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + static void OnFailureCallback_17(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_17(status); } - void OnFailureResponse_4(uint8_t status) { NextTest(); } + static void OnSuccessCallback_17(void * context, bool reachable) + { + (static_cast(context))->OnSuccessResponse_17(reachable); + } - void OnSuccessResponse_4() { ThrowSuccessResponse(); } + // + // Tests methods + // - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_5() + CHIP_ERROR TestQueryInteractionModelVersion_0() { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeInteractionModelVersion(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(int16_t measuredValue) + void OnSuccessResponse_0(uint16_t interactionModelVersion) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("interactionModelVersion", "", "uint16")); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_6() + CHIP_ERROR TestQueryVendorName_1() { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + return cluster.ReadAttributeVendorName(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(int16_t minMeasuredValue) + void OnSuccessResponse_1(chip::CharSpan vendorName) { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_7() + CHIP_ERROR TestQueryVendorID_2() { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + return cluster.ReadAttributeVendorID(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(int16_t maxMeasuredValue) + void OnSuccessResponse_2(uint16_t vendorID) { - VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("vendorID", "", "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 TestQueryProductName_3() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_2\n"); - } + return cluster.ReadAttributeProductName(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_3(chip::CharSpan productName) + { + VerifyOrReturn(CheckConstraintType("productName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("productName", productName.size(), 32)); + 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; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); - err = TestReadTheMandatoryAttributeMeasuredValue_1(); - break; - } + CHIP_ERROR TestQueryProductID_4() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeProductID(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); } -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 }; + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_0(void * context, uint8_t status) + void OnSuccessResponse_4(uint16_t productID) { - (static_cast(context))->OnFailureResponse_0(status); + VerifyOrReturn(CheckConstraintType("productID", "", "uint16")); + NextTest(); } - static void OnSuccessCallback_0(void * context, int16_t measuredValue) + CHIP_ERROR TestQueryUserLabel_5() { - (static_cast(context))->OnSuccessResponse_0(measuredValue); - } + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - static void OnFailureCallback_1(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_1(status); + return cluster.ReadAttributeUserLabel(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } - static void OnSuccessCallback_1(void * context, int16_t measuredValue) + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(chip::CharSpan userLabel) { - (static_cast(context))->OnSuccessResponse_1(measuredValue); + VerifyOrReturn(CheckConstraintType("userLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("userLabel", userLabel.size(), 32)); + NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() + CHIP_ERROR TestQueryUserLocation_6() { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeLocation(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(chip::CharSpan location) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("location", "", "string")); + VerifyOrReturn(CheckConstraintFormat("location", "", "ISO 3166-1 alpha-2")); + VerifyOrReturn(CheckConstraintMaxLength("location", location.size(), 2)); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() + CHIP_ERROR TestQueryHardwareVersion_7() { - chip::Controller::FlowMeasurementClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeHardwareVersion(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(int16_t measuredValue) + void OnSuccessResponse_7(uint16_t hardwareVersion) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("hardwareVersion", "", "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 TestQueryHardwareVersionString_8() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); - } + return cluster.ReadAttributeHardwareVersionString(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_8(chip::CharSpan hardwareVersionString) + { + VerifyOrReturn(CheckConstraintType("hardwareVersionString", "", "string")); + VerifyOrReturn(CheckConstraintMinLength("hardwareVersionString", hardwareVersionString.size(), 1)); + VerifyOrReturn(CheckConstraintMaxLength("hardwareVersionString", hardwareVersionString.size(), 64)); + 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 TestQuerySoftwareVersion_9() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + return cluster.ReadAttributeSoftwareVersion(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - static void OnFailureCallback_0(void * context, EmberAfStatus status) + void OnSuccessResponse_9(uint32_t softwareVersion) { - (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); + VerifyOrReturn(CheckConstraintType("softwareVersion", "", "uint32")); + NextTest(); } - static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } - - // - // Tests methods - // - - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + CHIP_ERROR TestQuerySoftwareVersionString_10() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 4U; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); + return cluster.ReadAttributeSoftwareVersionString(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); } - void OnFailureResponse_0(uint8_t status) { NextTest(); } - - void OnSuccessResponse_0() { ThrowSuccessResponse(); } -}; - -class Test_TC_LVL_2_1 : public TestCommand -{ -public: - Test_TC_LVL_2_1() : TestCommand("Test_TC_LVL_2_1"), mTestIndex(0) {} + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - /////////// TestCommand Interface ///////// - void NextTest() override + void OnSuccessResponse_10(chip::CharSpan softwareVersionString) { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_1\n"); - } + VerifyOrReturn(CheckConstraintType("softwareVersionString", "", "string")); + VerifyOrReturn(CheckConstraintFormat("softwareVersionString", "", "ASCII")); + VerifyOrReturn(CheckConstraintMinLength("softwareVersionString", softwareVersionString.size(), 1)); + VerifyOrReturn(CheckConstraintMaxLength("softwareVersionString", softwareVersionString.size(), 64)); + NextTest(); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + CHIP_ERROR TestQueryManufacturingDate_11() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - Wait(); + return cluster.ReadAttributeManufacturingDate(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + } - // 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; - } + void OnFailureResponse_11(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + 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(); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 13; + CHIP_ERROR TestQueryPartNumber_12() + { + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - 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 }; + return cluster.ReadAttributePartNumber(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + } - static void OnFailureCallback_0(void * context, uint8_t status) + void OnFailureResponse_12(uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); } - static void OnSuccessCallback_0(void * context, uint8_t currentLevel) + void OnSuccessResponse_12(chip::CharSpan partNumber) { - (static_cast(context))->OnSuccessResponse_0(currentLevel); + VerifyOrReturn(CheckConstraintType("partNumber", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("partNumber", partNumber.size(), 32)); + NextTest(); } - static void OnFailureCallback_3(void * context, uint8_t status) + CHIP_ERROR TestQueryProductURL_13() { - (static_cast(context))->OnFailureResponse_3(status); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeProductURL(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); } - static void OnSuccessCallback_3(void * context, uint8_t currentLevel) + void OnFailureResponse_13(uint8_t status) { - (static_cast(context))->OnSuccessResponse_3(currentLevel); + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); } - static void OnFailureCallback_6(void * context, uint8_t status) + void OnSuccessResponse_13(chip::CharSpan productURL) { - (static_cast(context))->OnFailureResponse_6(status); + VerifyOrReturn(CheckConstraintType("productURL", "", "string")); + VerifyOrReturn(CheckConstraintFormat("productURL", "", "RFC3986")); + VerifyOrReturn(CheckConstraintMaxLength("productURL", productURL.size(), 256)); + NextTest(); } - static void OnSuccessCallback_6(void * context, uint8_t currentLevel) + CHIP_ERROR TestQueryProductLabel_14() { - (static_cast(context))->OnSuccessResponse_6(currentLevel); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeProductLabel(mOnSuccessCallback_14.Cancel(), mOnFailureCallback_14.Cancel()); } - static void OnFailureCallback_7(void * context, uint8_t status) + void OnFailureResponse_14(uint8_t status) { - (static_cast(context))->OnFailureResponse_7(status); + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); } - static void OnSuccessCallback_7(void * context, uint16_t onOffTransitionTime) + void OnSuccessResponse_14(chip::CharSpan productLabel) { - (static_cast(context))->OnSuccessResponse_7(onOffTransitionTime); + VerifyOrReturn(CheckConstraintType("productLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("productLabel", productLabel.size(), 64)); + NextTest(); } - static void OnFailureCallback_10(void * context, uint8_t status) + CHIP_ERROR TestQuerySerialNumber_15() { - (static_cast(context))->OnFailureResponse_10(status); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); + + return cluster.ReadAttributeSerialNumber(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); } - static void OnSuccessCallback_10(void * context, uint8_t currentLevel) + void OnFailureResponse_15(uint8_t status) { - (static_cast(context))->OnSuccessResponse_10(currentLevel); + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_15(chip::CharSpan serialNumber) + { + VerifyOrReturn(CheckConstraintType("serialNumber", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("serialNumber", serialNumber.size(), 32)); + NextTest(); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() + CHIP_ERROR TestQueryLocalConfigDisabled_16() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeLocalConfigDisabled(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_16(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } - void OnSuccessResponse_0(uint8_t currentLevel) + void OnSuccessResponse_16(bool localConfigDisabled) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + VerifyOrReturn(CheckConstraintType("localConfigDisabled", "", "boolean")); NextTest(); } - CHIP_ERROR TestSendsAMoveToLevelCommand_1() + CHIP_ERROR TestQueryReachable_17() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevice, 0); - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; + return cluster.ReadAttributeReachable(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); + } - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 64; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; + void OnFailureResponse_17(uint8_t status) + { + (status == EMBER_ZCL_STATUS_UNSUPPORTED_ATTRIBUTE) ? NextTest() : ThrowFailureResponse(); + } - 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 OnSuccessResponse_17(bool reachable) + { + VerifyOrReturn(CheckConstraintType("reachable", "", "boolean")); + NextTest(); } +}; - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } +class Test_TC_DM_3_1 : public TestCommand +{ +public: + Test_TC_DM_3_1() : TestCommand("Test_TC_DM_3_1"), mTestIndex(0) {} - void OnSuccessResponse_1() { NextTest(); } + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; - CHIP_ERROR TestWait100ms_2() { return WaitForMs(100); } + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_3_1\n"); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_3_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); - } + Wait(); - void OnFailureResponse_3(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_3(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); - NextTest(); + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - CHIP_ERROR TestSendsAMoveToLevelCommand_4() +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 0; + + // + // Tests methods + // +}; + +class Test_TC_DM_2_2 : public TestCommand +{ +public: + Test_TC_DM_2_2() : TestCommand("Test_TC_DM_2_2"), 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::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DM_2_2\n"); + } - chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type request; - request.level = 128; - request.transitionTime = 1U; - request.optionMask = 1; - request.optionOverride = 1; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DM_2_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; + Wait(); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(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 : Query fabrics list\n"); + err = TestQueryFabricsList_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Query Supported Fabrics\n"); + err = TestQuerySupportedFabrics_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Query Commissioned Fabrics\n"); + err = TestQueryCommissionedFabrics_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Query User Trusted Root Certificates\n"); + err = TestQueryUserTrustedRootCertificates_3(); + break; + } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } - void OnSuccessResponse_4() { NextTest(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 4; - CHIP_ERROR TestWait200ms_5() { return WaitForMs(200); } + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback & fabricsList)> + 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 & trustedRootCertificates)> + mOnSuccessCallback_3{ OnSuccessCallback_3, this }; - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() + static void OnFailureCallback_0(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + (static_cast(context))->OnFailureResponse_0(status); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_6(uint8_t currentLevel) + static void + OnSuccessCallback_0(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabricsList) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); - NextTest(); + (static_cast(context))->OnSuccessResponse_0(fabricsList); } - CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_7() + static void OnFailureCallback_1(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_1(status); + } - return cluster.ReadAttributeOnOffTransitionTime(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + static void OnSuccessCallback_1(void * context, uint8_t supportedFabrics) + { + (static_cast(context))->OnSuccessResponse_1(supportedFabrics); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } - void OnSuccessResponse_7(uint16_t onOffTransitionTime) + static void OnSuccessCallback_2(void * context, uint8_t commissionedFabrics) { - VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); - NextTest(); + (static_cast(context))->OnSuccessResponse_2(commissionedFabrics); } - CHIP_ERROR TestSendsAMoveToLevelCommand_8() + static void OnFailureCallback_3(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_3(status); + } - using requestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - using responseType = chip::app::DataModel::NullObjectType; + static void OnSuccessCallback_3(void * context, + const chip::app::DataModel::DecodableList & trustedRootCertificates) + { + (static_cast(context))->OnSuccessResponse_3(trustedRootCertificates); + } - 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 TestQueryFabricsList_0() + { + chip::Controller::OperationalCredentialsClusterTest 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.ReadAttributeFabricsList(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(const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabricsList) + { + VerifyOrReturn(CheckValueAsListLength("fabricsList", fabricsList, 1)); + NextTest(); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + CHIP_ERROR TestQuerySupportedFabrics_1() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevice, 0); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeSupportedFabrics(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(uint8_t supportedFabrics) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + VerifyOrReturn(CheckValue("supportedFabrics", supportedFabrics, 16)); NextTest(); } - CHIP_ERROR TestResetLevelTo0_11() + CHIP_ERROR TestQueryCommissionedFabrics_2() { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevice, 0); - 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; + return cluster.ReadAttributeCommissionedFabrics(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_11(); - }; + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + void OnSuccessResponse_2(uint8_t commissionedFabrics) + { + VerifyOrReturn(CheckValue("commissionedFabrics", commissionedFabrics, 1)); + NextTest(); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + CHIP_ERROR TestQueryUserTrustedRootCertificates_3() + { + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevice, 0); - void OnSuccessResponse_11() { NextTest(); } + return cluster.ReadAttributeTrustedRootCertificates(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } - CHIP_ERROR TestWait100ms_12() { return WaitForMs(100); } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & trustedRootCertificates) + { + VerifyOrReturn(CheckValueAsListLength("trustedRootCertificates", trustedRootCertificates, 1)); + NextTest(); + } }; -class Test_TC_LVL_3_1 : public TestCommand +class Test_TC_EMR_1_1 : public TestCommand { public: - Test_TC_LVL_3_1() : TestCommand("Test_TC_LVL_3_1"), mTestIndex(0) {} + Test_TC_EMR_1_1() : TestCommand("Test_TC_EMR_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -13120,12 +13277,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_EMR_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EMR_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -13139,60 +13296,17 @@ 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(); + 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 : 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 2 : reads back global attribute: ClusterRevision\n"); + err = TestReadsBackGlobalAttributeClusterRevision_2(); break; } @@ -13205,327 +13319,173 @@ class Test_TC_LVL_3_1 : 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_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_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_0{ OnSuccessCallback_0, 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, 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_cast(context))->OnFailureResponse_0(status); } - static void OnFailureCallback_9(void * context, EmberAfStatus status) + static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnFailureResponse_9(chip::to_underlying(status)); + (static_cast(context))->OnSuccessResponse_0(clusterRevision); } - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } - - static void OnFailureCallback_10(void * context, uint8_t status) + static void OnFailureCallback_1(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); } - static void OnSuccessCallback_10(void * context, uint8_t defaultMoveRate) - { - (static_cast(context))->OnSuccessResponse_10(defaultMoveRate); - } + static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - static void OnFailureCallback_13(void * context, uint8_t status) + static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_13(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_13(void * context, uint8_t currentLevel) + static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) { - (static_cast(context))->OnSuccessResponse_13(currentLevel); + (static_cast(context))->OnSuccessResponse_2(clusterRevision); } // // Tests methods // - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_0() + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::ElectricalMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(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(uint8_t currentLevel) + void OnSuccessResponse_0(uint16_t clusterRevision) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); NextTest(); } - CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::ElectricalMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeMaxLevel(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 1U; + + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { NextTest(); } - void OnSuccessResponse_1(uint8_t maxLevel) - { - VerifyOrReturn(CheckValue("maxLevel", maxLevel, 255)); - NextTest(); - } + void OnSuccessResponse_1() { ThrowSuccessResponse(); } - CHIP_ERROR TestSendsAMoveUpCommand_2() + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::ElectricalMeasurementClusterTest 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); + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2() { NextTest(); } - - CHIP_ERROR TestWait3000ms_3() { return WaitForMs(3000); } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + void OnSuccessResponse_2(uint16_t clusterRevision) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 3U)); + NextTest(); } +}; - 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); } +class Test_TC_FLW_1_1 : public TestCommand +{ +public: + Test_TC_FLW_1_1() : TestCommand("Test_TC_FLW_1_1"), mTestIndex(0) {} - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() + /////////// TestCommand Interface ///////// + void NextTest() override { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); - } + CHIP_ERROR err = CHIP_NO_ERROR; - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_1_1\n"); + } - void OnSuccessResponse_8(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); - NextTest(); - } + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - CHIP_ERROR TestWriteDefaultMoveRateAttributeFromDut_9() - { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); + Wait(); - uint8_t defaultMoveRateArgument; - defaultMoveRateArgument = 20; + // 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; + } - return cluster.WriteAttribute( - defaultMoveRateArgument, this, OnSuccessCallback_9, OnFailureCallback_9); + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_9() { NextTest(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_10() + static void OnFailureCallback_0(void * context, EmberAfStatus status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeDefaultMoveRate(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } - void OnSuccessResponse_10(uint8_t defaultMoveRate) - { - VerifyOrReturn(CheckValue("defaultMoveRate", defaultMoveRate, 20)); - NextTest(); - } + // + // Tests methods + // - CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_11() + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest 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); + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 2U; - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); } - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { NextTest(); } - void OnSuccessResponse_13(uint8_t currentLevel) - { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, 255)); - NextTest(); - } + void OnSuccessResponse_0() { ThrowSuccessResponse(); } }; -class Test_TC_LVL_4_1 : public TestCommand +class Test_TC_FLW_2_1 : public TestCommand { public: - Test_TC_LVL_4_1() : TestCommand("Test_TC_LVL_4_1"), mTestIndex(0) {} + Test_TC_FLW_2_1() : TestCommand("Test_TC_FLW_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -13534,12 +13494,12 @@ class Test_TC_LVL_4_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_4_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_4_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -13553,48 +13513,36 @@ class Test_TC_LVL_4_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Sending on command\n"); - err = TestSendingOnCommand_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Wait 3000ms\n"); - err = TestWait3000ms_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_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 : Sends step down command to DUT\n"); - err = TestSendsStepDownCommandToDut_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 : Wait 3000ms\n"); - err = TestWait3000ms_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_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(); + ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_7(); break; } @@ -13607,243 +13555,232 @@ class Test_TC_LVL_4_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; + const uint16_t mTestCount = 8; - chip::Callback::Callback mOnFailureCallback_3{ OnFailureCallback_3, this }; - chip::Callback::Callback mOnSuccessCallback_3{ OnSuccessCallback_3, this }; + 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_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_9{ OnFailureCallback_9, this }; - chip::Callback::Callback mOnSuccessCallback_9{ OnSuccessCallback_9, 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_3(void * context, uint8_t status) + static void OnFailureCallback_0(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_0(status); } - static void OnSuccessCallback_3(void * context, uint8_t currentLevel) + static void OnSuccessCallback_0(void * context, int16_t measuredValue) { - (static_cast(context))->OnSuccessResponse_3(currentLevel); + (static_cast(context))->OnSuccessResponse_0(measuredValue); } - 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 currentLevel) + static void OnSuccessCallback_1(void * context, int16_t minMeasuredValue) { - (static_cast(context))->OnSuccessResponse_6(currentLevel); + (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); } - static void OnFailureCallback_9(void * context, uint8_t status) + static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_9(void * context, uint8_t currentLevel) + static void OnSuccessCallback_2(void * context, int16_t maxMeasuredValue) { - (static_cast(context))->OnSuccessResponse_9(currentLevel); + (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); } - // - // Tests methods - // - - CHIP_ERROR TestSendingOnCommand_0() + static void OnFailureCallback_3(void * context, EmberAfStatus 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; + (static_cast(context))->OnFailureResponse_3(chip::to_underlying(status)); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); - }; + static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0() { NextTest(); } + static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() + static void OnFailureCallback_5(void * context, uint8_t status) { - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevice, 1); - - using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; - using responseType = chip::app::DataModel::NullObjectType; + (static_cast(context))->OnFailureResponse_5(status); + } - 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; + static void OnSuccessCallback_5(void * context, int16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_5(measuredValue); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + static void OnSuccessCallback_6(void * context, int16_t minMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_6(minMeasuredValue); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_7(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_7(status); + } - void OnSuccessResponse_1() { NextTest(); } + static void OnSuccessCallback_7(void * context, int16_t maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_7(maxMeasuredValue); + } - CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } + // + // Tests methods + // - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_3() + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint8_t currentLevel) + void OnSuccessResponse_0(int16_t measuredValue) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); NextTest(); } - CHIP_ERROR TestSendsStepDownCommandToDut_4() + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest 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); + return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_4() { NextTest(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - CHIP_ERROR TestWait3000ms_5() { return WaitForMs(3000); } + void OnSuccessResponse_1(int16_t minMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + NextTest(); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(uint8_t currentLevel) + void OnSuccessResponse_2(int16_t maxMeasuredValue) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); NextTest(); } - CHIP_ERROR TestSendsAStepUpCommand_7() + CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMinMeasuredValue_3() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::LevelControl::Commands::Step::Type; - using responseType = chip::app::DataModel::NullObjectType; + int16_t minMeasuredValueArgument; + minMeasuredValueArgument = 0; - 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; + return cluster.WriteAttribute( + minMeasuredValueArgument, this, OnSuccessCallback_3, OnFailureCallback_3); + } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; + void OnFailureResponse_3(uint8_t status) { NextTest(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); - }; - return cluster.InvokeCommand(request, this, success, failure); - } + void OnSuccessResponse_3() { ThrowSuccessResponse(); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + CHIP_ERROR TestWriteTheDefaultValueToOptionalAttributeMaxMeasuredValue_4() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnSuccessResponse_7() { NextTest(); } + int16_t maxMeasuredValueArgument; + maxMeasuredValueArgument = 0; - CHIP_ERROR TestWait3000ms_8() { return WaitForMs(3000); } + return cluster.WriteAttribute( + maxMeasuredValueArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() + void OnFailureResponse_4(uint8_t status) { NextTest(); } + + void OnSuccessResponse_4() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_5() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeCurrentLevel(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(uint8_t currentLevel) + void OnSuccessResponse_5(int16_t measuredValue) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); NextTest(); } - CHIP_ERROR TestSendingOffCommand_10() + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_6() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; - using responseType = chip::app::DataModel::NullObjectType; + return cluster.ReadAttributeMinMeasuredValue(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } - chip::app::Clusters::OnOff::Commands::Off::Type request; + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_10(); - }; + void OnSuccessResponse_6(int16_t minMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + NextTest(); + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_10(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_7() + { + chip::Controller::FlowMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeMaxMeasuredValue(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10() { NextTest(); } + void OnSuccessResponse_7(int16_t maxMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "uint16")); + NextTest(); + } }; -class Test_TC_LVL_5_1 : public TestCommand +class Test_TC_FLW_2_2 : public TestCommand { public: - Test_TC_LVL_5_1() : TestCommand("Test_TC_LVL_5_1"), mTestIndex(0) {} + Test_TC_FLW_2_2() : TestCommand("Test_TC_FLW_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -13852,12 +13789,12 @@ class Test_TC_LVL_5_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_5_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FLW_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_5_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FLW_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -13871,32 +13808,12 @@ class Test_TC_LVL_5_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Sending on command\n"); - err = TestSendingOnCommand_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_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(); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MeasuredValue\n"); + err = TestReadTheMandatoryAttributeMeasuredValue_1(); break; } @@ -13909,152 +13826,74 @@ class Test_TC_LVL_5_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 7; + const uint16_t mTestCount = 2; - // - // 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_ERROR TestSendingOnCommand_0() + static void OnFailureCallback_0(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_0(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + (static_cast(context))->OnFailureResponse_0(status); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0() { NextTest(); } - - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_1() + static void OnSuccessCallback_0(void * context, int16_t measuredValue) { - 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); + (static_cast(context))->OnSuccessResponse_0(measuredValue); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestWait3000ms_2() { return WaitForMs(3000); } - - CHIP_ERROR TestSendsAMoveUpCommandToDut_3() + static void OnFailureCallback_1(void * context, uint8_t status) { - 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); + (static_cast(context))->OnFailureResponse_1(status); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_3() { NextTest(); } + static void OnSuccessCallback_1(void * context, int16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_1(measuredValue); + } - CHIP_ERROR TestWait3000ms_4() { return WaitForMs(3000); } + // + // Tests methods + // - CHIP_ERROR TestSendsStopCommandToDut_5() + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_0() { - chip::Controller::LevelControlClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest 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); + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5() { NextTest(); } + void OnSuccessResponse_0(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } - CHIP_ERROR TestSendingOffCommand_6() + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_1() { - chip::Controller::OnOffClusterTest cluster; + chip::Controller::FlowMeasurementClusterTest 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); + return cluster.ReadAttributeMeasuredValue(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_1(int16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } }; -class Test_TC_MC_1_1 : public TestCommand +class Test_TC_LVL_1_1 : public TestCommand { public: - Test_TC_MC_1_1() : TestCommand("Test_TC_MC_1_1"), mTestIndex(0) {} + Test_TC_LVL_1_1() : TestCommand("Test_TC_LVL_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14063,12 +13902,12 @@ class Test_TC_MC_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14101,10 +13940,10 @@ class Test_TC_MC_1_1 : public TestCommand static void OnFailureCallback_0(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); } - static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } + static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } // // Tests methods @@ -14112,13 +13951,13 @@ class Test_TC_MC_1_1 : public TestCommand CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() { - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevice, 1); uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; + clusterRevisionArgument = 4U; - return cluster.WriteAttribute( + return cluster.WriteAttribute( clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); } @@ -14127,10 +13966,10 @@ class Test_TC_MC_1_1 : public TestCommand void OnSuccessResponse_0() { ThrowSuccessResponse(); } }; -class Test_TC_MC_2_1 : public TestCommand +class Test_TC_LVL_2_1 : public TestCommand { public: - Test_TC_MC_2_1() : TestCommand("Test_TC_MC_2_1"), mTestIndex(0) {} + Test_TC_LVL_2_1() : TestCommand("Test_TC_LVL_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14139,12 +13978,12 @@ class Test_TC_MC_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14158,8 +13997,56 @@ class Test_TC_MC_2_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Put the device into low power mode\n"); - err = TestPutTheDeviceIntoLowPowerMode_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; } @@ -14172,41 +14059,2345 @@ class Test_TC_MC_2_1 : public TestCommand 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); + const uint16_t mTestCount = 13; - using requestType = chip::app::Clusters::LowPower::Commands::Sleep::Type; + 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::LowPower::Commands::Sleep::Type request; + 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_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, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_9(chip::to_underlying(status)); + } + + static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } + + 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; + defaultMoveRateArgument = 20; + + return cluster.WriteAttribute( + defaultMoveRateArgument, this, OnSuccessCallback_9, OnFailureCallback_9); + } + + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9() { 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; + + static void OnFailureCallback_0(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_0(chip::to_underlying(status)); + } + + static void OnSuccessCallback_0(void * context) { (static_cast(context))->OnSuccessResponse_0(); } + + // + // Tests methods + // + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_0() + { + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 1U; + + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_0, OnFailureCallback_0); + } + + void OnFailureResponse_0(uint8_t status) { NextTest(); } + + void OnSuccessResponse_0() { 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; + + 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; + } + + 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_OCC_1_1 : public TestCommand +{ +public: + Test_TC_OCC_1_1() : TestCommand("Test_TC_OCC_1_1"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_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; + } + + 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 }; + + 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, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + } + + static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + + // + // Tests methods + // + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + { + chip::Controller::OccupancySensingClusterTest 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, 2U)); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 2U; + + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + } + + void OnFailureResponse_1(uint8_t status) { NextTest(); } + + void OnSuccessResponse_1() { ThrowSuccessResponse(); } +}; + +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_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_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 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; + } + + 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 = 9; + + chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; + chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, 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_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 }; + + 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, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + } + + static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + + static void OnFailureCallback_2(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint8_t occupancy) + { + (static_cast(context))->OnSuccessResponse_2(occupancy); + } + + static void OnFailureCallback_3(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint8_t occupancySensorType) + { + (static_cast(context))->OnSuccessResponse_3(occupancySensorType); + } + + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + } + + static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } + + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint8_t occupancySensorType) + { + (static_cast(context))->OnSuccessResponse_5(occupancySensorType); + } + + static void OnFailureCallback_6(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint8_t occupancySensorTypeBitmap) + { + (static_cast(context))->OnSuccessResponse_6(occupancySensorTypeBitmap); + } + + static void OnFailureCallback_7(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_7(chip::to_underlying(status)); + } + + static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } + + static void OnFailureCallback_8(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, uint8_t occupancySensorTypeBitmap) + { + (static_cast(context))->OnSuccessResponse_8(occupancySensorTypeBitmap); + } + + // + // Tests methods + // + + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancy_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")); + VerifyOrReturn(CheckConstraintMaxValue("occupancy", occupancy, 1)); + NextTest(); + } + + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint8_t occupancyArgument; + occupancyArgument = 0; + + return cluster.WriteAttribute( + occupancyArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + } + + void OnFailureResponse_1(uint8_t status) { NextTest(); } + + void OnSuccessResponse_1() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancy_2() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancy(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint8_t occupancy) + { + VerifyOrReturn(CheckValue("occupancy", occupancy, 0)); + NextTest(); + } + + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorType_3() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + } + + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t occupancySensorType) + { + VerifyOrReturn(CheckConstraintType("occupancySensorType", "", "enum8")); + VerifyOrReturn(CheckConstraintMaxValue("occupancySensorType", occupancySensorType, 3)); + NextTest(); + } + + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint8_t occupancySensorTypeArgument; + occupancySensorTypeArgument = static_cast(0); + + return cluster.WriteAttribute( + occupancySensorTypeArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + } + + void OnFailureResponse_4(uint8_t status) { NextTest(); } + + void OnSuccessResponse_4() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorType_5() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + } + + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint8_t occupancySensorType) + { + VerifyOrReturn(CheckValue("occupancySensorType", occupancySensorType, 0)); + NextTest(); + } + + CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); - }; + return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(uint8_t occupancySensorTypeBitmap) + { + VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "", "map8")); + VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); + VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 7)); + NextTest(); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); - void OnSuccessResponse_0() { NextTest(); } + uint8_t occupancySensorTypeBitmapArgument; + occupancySensorTypeBitmapArgument = 1; + + return cluster.WriteAttribute( + occupancySensorTypeBitmapArgument, this, OnSuccessCallback_7, OnFailureCallback_7); + } + + void OnFailureResponse_7(uint8_t status) { NextTest(); } + + void OnSuccessResponse_7() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8() + { + chip::Controller::OccupancySensingClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + } + + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(uint8_t occupancySensorTypeBitmap) + { + VerifyOrReturn(CheckValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); + NextTest(); + } }; -class Test_TC_MC_3_1 : public TestCommand +class Test_TC_OCC_2_2 : public TestCommand { public: - Test_TC_MC_3_1() : TestCommand("Test_TC_MC_3_1"), mTestIndex(0) {} + Test_TC_OCC_2_2() : TestCommand("Test_TC_OCC_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14215,12 +16406,12 @@ class Test_TC_MC_3_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14233,6 +16424,14 @@ class Test_TC_MC_3_1 : 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) @@ -14244,17 +16443,74 @@ class Test_TC_MC_3_1 : 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_2 : public TestCommand +class Test_TC_OO_1_1 : public TestCommand { public: - Test_TC_MC_3_2() : TestCommand("Test_TC_MC_3_2"), mTestIndex(0) {} + Test_TC_OO_1_1() : TestCommand("Test_TC_OO_1_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14263,12 +16519,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_OO_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14281,6 +16537,31 @@ 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 : 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) @@ -14292,113 +16573,176 @@ class Test_TC_MC_3_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + 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_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_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, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + } + + static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + + 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, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + } + + static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } + + 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 // -}; -class Test_TC_MC_3_3 : public TestCommand -{ -public: - Test_TC_MC_3_3() : TestCommand("Test_TC_MC_3_3"), mTestIndex(0) {} + 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; + clusterRevisionArgument = 3U; + + return cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + } + + void OnFailureResponse_1(uint8_t status) { NextTest(); } - /////////// TestCommand Interface ///////// - void NextTest() override + void OnSuccessResponse_1() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_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_3\n"); - } + return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - Wait(); + void OnSuccessResponse_2(uint16_t clusterRevision) + { + VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); + 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 TestReadTheOptionalGlobalAttributeFeatureMap_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.ReadAttributeFeatureMap(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_4 : public TestCommand -{ -public: - Test_TC_MC_3_4() : TestCommand("Test_TC_MC_3_4"), mTestIndex(0) {} + void OnSuccessResponse_3(uint32_t featureMap) + { + VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + NextTest(); + } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_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_4\n"); - } + uint32_t featureMapArgument; + featureMapArgument = 0UL; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + return cluster.WriteAttribute( + featureMapArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + } - Wait(); + void OnFailureResponse_4(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++) - { - } + void OnSuccessResponse_4() { ThrowSuccessResponse(); } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_5() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeFeatureMap(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(uint32_t featureMap) + { + VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + NextTest(); + } }; -class Test_TC_MC_3_5 : public TestCommand +class Test_TC_OO_2_1 : public TestCommand { public: - Test_TC_MC_3_5() : TestCommand("Test_TC_MC_3_5"), mTestIndex(0) {} + Test_TC_OO_2_1() : TestCommand("Test_TC_OO_2_1"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14407,12 +16751,12 @@ class Test_TC_MC_3_5 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14425,6 +16769,54 @@ class Test_TC_MC_3_5 : 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) @@ -14436,414 +16828,339 @@ class Test_TC_MC_3_5 : 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_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_6 : public TestCommand -{ -public: - Test_TC_MC_3_6() : TestCommand("Test_TC_MC_3_6"), 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_6\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_6\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; - - // - // Tests methods - // -}; + static void OnSuccessCallback_3(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_3(onTime); + } -class Test_TC_MC_3_7 : public TestCommand -{ -public: - Test_TC_MC_3_7() : TestCommand("Test_TC_MC_3_7"), mTestIndex(0) {} + static void OnFailureCallback_4(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_4(status); + } - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnSuccessCallback_4(void * context, uint16_t offWaitTime) { - CHIP_ERROR err = CHIP_NO_ERROR; + (static_cast(context))->OnSuccessResponse_4(offWaitTime); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); - } + static void OnFailureCallback_5(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_5(status); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnSuccessCallback_5(void * context, uint8_t startUpOnOff) + { + (static_cast(context))->OnSuccessResponse_5(startUpOnOff); + } - Wait(); + static void OnFailureCallback_6(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_6(chip::to_underlying(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_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnFailureCallback_7(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_7(chip::to_underlying(status)); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - // - // Tests methods - // -}; + static void OnFailureCallback_8(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_8(chip::to_underlying(status)); + } -class Test_TC_MC_3_8 : public TestCommand -{ -public: - Test_TC_MC_3_8() : TestCommand("Test_TC_MC_3_8"), mTestIndex(0) {} + static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnFailureCallback_9(void * context, uint8_t status) { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); - } + (static_cast(context))->OnFailureResponse_9(status); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnSuccessCallback_9(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_9(onTime); + } - Wait(); + static void OnFailureCallback_10(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_10(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_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_9 : public TestCommand -{ -public: - Test_TC_MC_3_9() : TestCommand("Test_TC_MC_3_9"), 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_9\n"); - } + return cluster.ReadAttributeOnOff(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\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_10 : public TestCommand -{ -public: - Test_TC_MC_3_10() : TestCommand("Test_TC_MC_3_10"), 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_10\n"); - } + return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\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_11 : public TestCommand -{ -public: - Test_TC_MC_3_11() : TestCommand("Test_TC_MC_3_11"), 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_11\n"); - } + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\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; - - // - // Tests methods - // -}; + void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } -class Test_TC_OCC_1_1 : public TestCommand -{ -public: - Test_TC_OCC_1_1() : TestCommand("Test_TC_OCC_1_1"), mTestIndex(0) {} + void OnSuccessResponse_5(uint8_t startUpOnOff) + { + VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + NextTest(); + } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOnTime_6() { - CHIP_ERROR err = CHIP_NO_ERROR; + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_1_1\n"); - } + uint16_t onTimeArgument; + onTimeArgument = 0U; - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + return cluster.WriteAttribute( + onTimeArgument, this, OnSuccessCallback_6, OnFailureCallback_6); + } - Wait(); + void OnFailureResponse_6(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 : 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; - } + void OnSuccessResponse_6() { NextTest(); } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOffWaitTime_7() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + uint16_t offWaitTimeArgument; + offWaitTimeArgument = 0U; + + return cluster.WriteAttribute( + offWaitTimeArgument, this, OnSuccessCallback_7, OnFailureCallback_7); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, this }; + void OnSuccessResponse_7() { NextTest(); } - static void OnFailureCallback_0(void * context, uint8_t status) + CHIP_ERROR TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8() { - (static_cast(context))->OnFailureResponse_0(status); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) - { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + uint8_t startUpOnOffArgument; + startUpOnOffArgument = static_cast(0); + + return cluster.WriteAttribute( + startUpOnOffArgument, this, OnSuccessCallback_8, OnFailureCallback_8); } - static void OnFailureCallback_1(void * context, EmberAfStatus status) + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8() { NextTest(); } + + CHIP_ERROR TestReadsBackLtAttributeOnTime_9() { - (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnTime(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - // - // Tests methods - // + void OnSuccessResponse_9(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + CHIP_ERROR TestReadsBackLtAttributeOffWaitTime_10() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0(uint16_t clusterRevision) + void OnSuccessResponse_10(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 2U)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + CHIP_ERROR TestReadsBackLtAttributeStartUpOnOff_11() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 2U; - - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1() { ThrowSuccessResponse(); } + void OnSuccessResponse_11(uint8_t startUpOnOff) + { + VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + NextTest(); + } }; -class Test_TC_OCC_2_1 : public TestCommand +class Test_TC_OO_2_2 : public TestCommand { public: - Test_TC_OCC_2_1() : TestCommand("Test_TC_OCC_2_1"), mTestIndex(0) {} + Test_TC_OO_2_2() : TestCommand("Test_TC_OO_2_2"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -14852,12 +17169,12 @@ class Test_TC_OCC_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -14871,44 +17188,60 @@ class Test_TC_OCC_2_1 : public TestCommand switch (mTestIndex++) { case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Reads mandatory attribute constrains: Occupancy\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancy_0(); + ChipLogProgress(chipTool, " ***** Test Step 0 : Send Off Command\n"); + err = TestSendOffCommand_0(); break; case 1: - ChipLogProgress(chipTool, - " ***** Test Step 1 : Writes the respective default value to mandatory attribute: Occupancy\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_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 : Reads back mandatory attribute: Occupancy\n"); - err = TestReadsBackMandatoryAttributeOccupancy_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Send On Command\n"); + err = TestSendOnCommand_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads mandatory attribute constrains: OccupancySensorType\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorType_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 : Writes the respective default value to mandatory attribute: OccupancySensorType\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Send Off Command\n"); + err = TestSendOffCommand_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Reads back mandatory attribute: OccupancySensorType\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorType_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 : Reads mandatory attribute constrains: OccupancySensorTypeBitmap\n"); - err = TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Send Toggle Command\n"); + err = TestSendToggleCommand_6(); break; case 7: - ChipLogProgress( - chipTool, - " ***** Test Step 7 : Writes the respective default value to mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_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 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Reads back mandatory attribute: OccupancySensorTypeBitmap\n"); - err = TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8(); + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13(); break; } @@ -14921,376 +17254,382 @@ class Test_TC_OCC_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + 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_2{ OnFailureCallback_2, this }; - chip::Callback::Callback mOnSuccessCallback_2{ OnSuccessCallback_2, 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 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_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 }; - - static void OnFailureCallback_0(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_0(status); - } + 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 OnSuccessCallback_0(void * context, uint8_t occupancy) + static void OnFailureCallback_1(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_0(occupancy); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnFailureCallback_1(void * context, EmberAfStatus status) + static void OnSuccessCallback_1(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + (static_cast(context))->OnSuccessResponse_1(onOff); } - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_2(void * context, uint8_t occupancy) + static void OnSuccessCallback_3(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_2(occupancy); + (static_cast(context))->OnSuccessResponse_3(onOff); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnFailureCallback_5(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_5(status); } - static void OnSuccessCallback_3(void * context, uint8_t occupancySensorType) + static void OnSuccessCallback_5(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_3(occupancySensorType); + (static_cast(context))->OnSuccessResponse_5(onOff); } - static void OnFailureCallback_4(void * context, EmberAfStatus status) + static void OnFailureCallback_7(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_7(status); } - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnSuccessCallback_7(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnSuccessResponse_7(onOff); } - static void OnSuccessCallback_5(void * context, uint8_t occupancySensorType) + static void OnFailureCallback_9(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_5(occupancySensorType); + (static_cast(context))->OnFailureResponse_9(status); } - static void OnFailureCallback_6(void * context, uint8_t status) + static void OnSuccessCallback_9(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnSuccessResponse_9(onOff); } - static void OnSuccessCallback_6(void * context, uint8_t occupancySensorTypeBitmap) + static void OnFailureCallback_11(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_6(occupancySensorTypeBitmap); + (static_cast(context))->OnFailureResponse_11(status); } - static void OnFailureCallback_7(void * context, EmberAfStatus status) + static void OnSuccessCallback_11(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_7(chip::to_underlying(status)); + (static_cast(context))->OnSuccessResponse_11(onOff); } - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } - - static void OnFailureCallback_8(void * context, uint8_t status) + static void OnFailureCallback_13(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_13(status); } - static void OnSuccessCallback_8(void * context, uint8_t occupancySensorTypeBitmap) + static void OnSuccessCallback_13(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_8(occupancySensorTypeBitmap); + (static_cast(context))->OnSuccessResponse_13(onOff); } // // Tests methods // - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancy_0() + CHIP_ERROR TestSendOffCommand_0() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + 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(uint8_t occupancy) - { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); - VerifyOrReturn(CheckConstraintMaxValue("occupancy", occupancy, 1)); - NextTest(); - } + void OnSuccessResponse_0() { NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancy_1() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t occupancyArgument; - occupancyArgument = 0; - - return cluster.WriteAttribute( - occupancyArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1() { ThrowSuccessResponse(); } + void OnSuccessResponse_1(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); + } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancy_2() + CHIP_ERROR TestSendOnCommand_2() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + 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); } void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t occupancy) - { - VerifyOrReturn(CheckValue("occupancy", occupancy, 0)); - NextTest(); - } + void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorType_3() + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint8_t occupancySensorType) + void OnSuccessResponse_3(bool onOff) { - VerifyOrReturn(CheckConstraintType("occupancySensorType", "", "enum8")); - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorType", occupancySensorType, 3)); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorType_4() + CHIP_ERROR TestSendOffCommand_4() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t occupancySensorTypeArgument; - occupancySensorTypeArgument = static_cast(0); + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttribute( - occupancySensorTypeArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + 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); } - void OnFailureResponse_4(uint8_t status) { NextTest(); } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4() { ThrowSuccessResponse(); } + void OnSuccessResponse_4() { NextTest(); } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorType_5() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorType(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); } void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint8_t occupancySensorType) + void OnSuccessResponse_5(bool onOff) { - VerifyOrReturn(CheckValue("occupancySensorType", occupancySensorType, 0)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestReadsMandatoryAttributeConstrainsOccupancySensorTypeBitmap_6() + CHIP_ERROR TestSendToggleCommand_6() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + 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(); + }; + + 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(uint8_t occupancySensorTypeBitmap) + void OnSuccessResponse_6() { NextTest(); } + + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7() { - VerifyOrReturn(CheckConstraintType("occupancySensorTypeBitmap", "", "map8")); - VerifyOrReturn(CheckConstraintMinValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); - VerifyOrReturn(CheckConstraintMaxValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 7)); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributeOccupancySensorTypeBitmap_7() + CHIP_ERROR TestSendToggleCommand_8() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t occupancySensorTypeBitmapArgument; - occupancySensorTypeBitmapArgument = 1; + using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; + using responseType = chip::app::DataModel::NullObjectType; + + chip::app::Clusters::OnOff::Commands::Toggle::Type request; - return cluster.WriteAttribute( - occupancySensorTypeBitmapArgument, this, OnSuccessCallback_7, OnFailureCallback_7); + 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_7(uint8_t status) { NextTest(); } + void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7() { ThrowSuccessResponse(); } + void OnSuccessResponse_8() { NextTest(); } - CHIP_ERROR TestReadsBackMandatoryAttributeOccupancySensorTypeBitmap_8() + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancySensorTypeBitmap(mOnSuccessCallback_8.Cancel(), mOnFailureCallback_8.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint8_t occupancySensorTypeBitmap) + void OnSuccessResponse_9(bool onOff) { - VerifyOrReturn(CheckValue("occupancySensorTypeBitmap", occupancySensorTypeBitmap, 1)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } -}; - -class Test_TC_OCC_2_2 : public TestCommand -{ -public: - Test_TC_OCC_2_2() : TestCommand("Test_TC_OCC_2_2"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestSendOnCommand_10() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OCC_2_2\n"); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OCC_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; - Wait(); + chip::app::Clusters::OnOff::Commands::On::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 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; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_10(); + }; - 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_10(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + void OnFailureResponse_10(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 }; + void OnSuccessResponse_10() { NextTest(); } - static void OnFailureCallback_0(void * context, uint8_t status) + CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11() { - (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_11.Cancel(), mOnFailureCallback_11.Cancel()); } - static void OnFailureCallback_1(void * context, uint8_t status) - { - (static_cast(context))->OnFailureResponse_1(status); - } + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } - static void OnSuccessCallback_1(void * context, uint8_t occupancy) + void OnSuccessResponse_11(bool onOff) { - (static_cast(context))->OnSuccessResponse_1(occupancy); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestReadsOccupancyAttributeFromDut_0() + CHIP_ERROR TestSendOffCommand_12() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); - } + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + chip::app::Clusters::OnOff::Commands::Off::Type request; - void OnSuccessResponse_0(uint8_t occupancy) - { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); - NextTest(); + 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); } - CHIP_ERROR TestReadsOccupancyAttributeFromDut_1() + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_12() { NextTest(); } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13() { - chip::Controller::OccupancySensingClusterTest cluster; + chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOccupancy(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(uint8_t occupancy) + void OnSuccessResponse_13(bool onOff) { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } }; -class Test_TC_OO_1_1 : public TestCommand +class Test_TC_OO_2_3 : public TestCommand { public: - Test_TC_OO_1_1() : TestCommand("Test_TC_OO_1_1"), mTestIndex(0) {} + Test_TC_OO_2_3() : TestCommand("Test_TC_OO_2_3"), mTestIndex(0) {} /////////// TestCommand Interface ///////// void NextTest() override @@ -15299,12 +17638,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_OO_2_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -15318,29 +17657,188 @@ 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 : Send On Command\n"); + err = TestSendOnCommand_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 : Wait 1000ms\n"); + err = TestWait1000ms_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads GlobalSceneControl attribute from DUT\n"); + err = TestReadsGlobalSceneControlAttributeFromDut_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 : Send On Command\n"); + err = TestSendOnCommand_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : reads back optional global attribute: FeatureMap\n"); - err = TestReadsBackOptionalGlobalAttributeFeatureMap_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 1000ms\n"); + err = TestWait1000ms_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads GlobalSceneControl attribute from DUT\n"); + err = TestReadsGlobalSceneControlAttributeFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Send On Command\n"); + err = TestSendOnCommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 1000ms\n"); + err = TestWait1000ms_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Reads GlobalSceneControl attribute from DUT\n"); + err = TestReadsGlobalSceneControlAttributeFromDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Send On Command\n"); + err = TestSendOnCommand_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Send Off Command\n"); + err = TestSendOffCommand_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Send On Command\n"); + err = TestSendOnCommand_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_26(); + break; + case 27: + ChipLogProgress(chipTool, " ***** Test Step 27 : Send Off Command\n"); + err = TestSendOffCommand_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_30(); + break; + case 31: + ChipLogProgress(chipTool, " ***** Test Step 31 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : Send On Command\n"); + err = TestSendOnCommand_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : Send Off Command\n"); + err = TestSendOffCommand_36(); + break; + case 37: + ChipLogProgress(chipTool, " ***** Test Step 37 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_37(); + break; + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_38(); + break; + case 39: + ChipLogProgress(chipTool, " ***** Test Step 39 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_39(); + break; + case 40: + ChipLogProgress(chipTool, " ***** Test Step 40 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_40(); + break; + case 41: + ChipLogProgress(chipTool, " ***** Test Step 41 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_41(); + break; + case 42: + ChipLogProgress(chipTool, " ***** Test Step 42 : Reads OnOff attribute from DUT\n"); + err = TestReadsOnOffAttributeFromDut_42(); + break; + case 43: + ChipLogProgress(chipTool, " ***** Test Step 43 : Reads OnTime attribute from DUT\n"); + err = TestReadsOnTimeAttributeFromDut_43(); + break; + case 44: + ChipLogProgress(chipTool, " ***** Test Step 44 : Reads OffWaitTime attribute from DUT\n"); + err = TestReadsOffWaitTimeAttributeFromDut_44(); + break; + case 45: + ChipLogProgress(chipTool, " ***** Test Step 45 : Send Off Command\n"); + err = TestSendOffCommand_45(); break; } @@ -15353,859 +17851,1008 @@ class Test_TC_OO_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 46; - chip::Callback::Callback mOnFailureCallback_0{ OnFailureCallback_0, this }; - chip::Callback::Callback mOnSuccessCallback_0{ OnSuccessCallback_0, 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 mOnFailureCallback_5{ OnFailureCallback_5, this }; - chip::Callback::Callback mOnSuccessCallback_5{ OnSuccessCallback_5, 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 }; + 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_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 }; + chip::Callback::Callback mOnFailureCallback_19{ OnFailureCallback_19, this }; + chip::Callback::Callback mOnSuccessCallback_19{ OnSuccessCallback_19, this }; + chip::Callback::Callback mOnFailureCallback_20{ OnFailureCallback_20, this }; + chip::Callback::Callback mOnSuccessCallback_20{ OnSuccessCallback_20, this }; + chip::Callback::Callback mOnFailureCallback_21{ OnFailureCallback_21, this }; + chip::Callback::Callback mOnSuccessCallback_21{ OnSuccessCallback_21, this }; + chip::Callback::Callback mOnFailureCallback_22{ OnFailureCallback_22, this }; + chip::Callback::Callback mOnSuccessCallback_22{ OnSuccessCallback_22, this }; + chip::Callback::Callback mOnFailureCallback_23{ OnFailureCallback_23, this }; + chip::Callback::Callback mOnSuccessCallback_23{ OnSuccessCallback_23, this }; + chip::Callback::Callback mOnFailureCallback_25{ OnFailureCallback_25, this }; + chip::Callback::Callback mOnSuccessCallback_25{ OnSuccessCallback_25, this }; + chip::Callback::Callback mOnFailureCallback_26{ OnFailureCallback_26, this }; + chip::Callback::Callback mOnSuccessCallback_26{ OnSuccessCallback_26, this }; + chip::Callback::Callback mOnFailureCallback_28{ OnFailureCallback_28, this }; + chip::Callback::Callback mOnSuccessCallback_28{ OnSuccessCallback_28, this }; + chip::Callback::Callback mOnFailureCallback_29{ OnFailureCallback_29, this }; + chip::Callback::Callback mOnSuccessCallback_29{ OnSuccessCallback_29, this }; + chip::Callback::Callback mOnFailureCallback_30{ OnFailureCallback_30, this }; + chip::Callback::Callback mOnSuccessCallback_30{ OnSuccessCallback_30, this }; + chip::Callback::Callback mOnFailureCallback_31{ OnFailureCallback_31, this }; + chip::Callback::Callback mOnSuccessCallback_31{ OnSuccessCallback_31, this }; + chip::Callback::Callback mOnFailureCallback_33{ OnFailureCallback_33, this }; + chip::Callback::Callback mOnSuccessCallback_33{ OnSuccessCallback_33, this }; + chip::Callback::Callback mOnFailureCallback_34{ OnFailureCallback_34, this }; + chip::Callback::Callback mOnSuccessCallback_34{ OnSuccessCallback_34, this }; + chip::Callback::Callback mOnFailureCallback_35{ OnFailureCallback_35, this }; + chip::Callback::Callback mOnSuccessCallback_35{ OnSuccessCallback_35, this }; + chip::Callback::Callback mOnFailureCallback_37{ OnFailureCallback_37, this }; + chip::Callback::Callback mOnSuccessCallback_37{ OnSuccessCallback_37, this }; + chip::Callback::Callback mOnFailureCallback_38{ OnFailureCallback_38, this }; + chip::Callback::Callback mOnSuccessCallback_38{ OnSuccessCallback_38, this }; + chip::Callback::Callback mOnFailureCallback_39{ OnFailureCallback_39, this }; + chip::Callback::Callback mOnSuccessCallback_39{ OnSuccessCallback_39, this }; + chip::Callback::Callback mOnFailureCallback_40{ OnFailureCallback_40, this }; + chip::Callback::Callback mOnSuccessCallback_40{ OnSuccessCallback_40, this }; + chip::Callback::Callback mOnFailureCallback_41{ OnFailureCallback_41, this }; + chip::Callback::Callback mOnSuccessCallback_41{ OnSuccessCallback_41, this }; + chip::Callback::Callback mOnFailureCallback_42{ OnFailureCallback_42, this }; + chip::Callback::Callback mOnSuccessCallback_42{ OnSuccessCallback_42, this }; + chip::Callback::Callback mOnFailureCallback_43{ OnFailureCallback_43, this }; + chip::Callback::Callback mOnSuccessCallback_43{ OnSuccessCallback_43, this }; + chip::Callback::Callback mOnFailureCallback_44{ OnFailureCallback_44, this }; + chip::Callback::Callback mOnSuccessCallback_44{ OnSuccessCallback_44, this }; - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_2(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_0(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_2(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_0(clusterRevision); + (static_cast(context))->OnSuccessResponse_2(onOff); } - static void OnFailureCallback_1(void * context, EmberAfStatus status) + static void OnFailureCallback_3(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_1(void * context) { (static_cast(context))->OnSuccessResponse_1(); } - - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnSuccessCallback_3(void * context, bool globalSceneControl) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnSuccessResponse_3(globalSceneControl); } - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + static void OnFailureCallback_6(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + (static_cast(context))->OnFailureResponse_6(status); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnSuccessCallback_6(void * context, bool onOff) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnSuccessResponse_6(onOff); } - static void OnSuccessCallback_3(void * context, uint32_t featureMap) + static void OnFailureCallback_7(void * context, uint8_t status) { - (static_cast(context))->OnSuccessResponse_3(featureMap); + (static_cast(context))->OnFailureResponse_7(status); } - static void OnFailureCallback_4(void * context, EmberAfStatus status) + static void OnSuccessCallback_7(void * context, bool globalSceneControl) { - (static_cast(context))->OnFailureResponse_4(chip::to_underlying(status)); + (static_cast(context))->OnSuccessResponse_7(globalSceneControl); } - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } - - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnFailureCallback_10(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_5(void * context, uint32_t featureMap) + static void OnSuccessCallback_10(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_5(featureMap); + (static_cast(context))->OnSuccessResponse_10(onOff); } - // - // Tests methods - // - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_0() + static void OnFailureCallback_11(void * context, uint8_t status) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + (static_cast(context))->OnFailureResponse_11(status); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_0(uint16_t clusterRevision) + static void OnSuccessCallback_11(void * context, bool globalSceneControl) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); - NextTest(); + (static_cast(context))->OnSuccessResponse_11(globalSceneControl); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_1() + static void OnFailureCallback_12(void * context, uint8_t status) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_12(status); + } - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 3U; + static void OnSuccessCallback_12(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_12(onTime); + } - return cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_1, OnFailureCallback_1); + static void OnFailureCallback_13(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_13(status); } - void OnFailureResponse_1(uint8_t status) { NextTest(); } + static void OnSuccessCallback_13(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_13(offWaitTime); + } - void OnSuccessResponse_1() { ThrowSuccessResponse(); } + static void OnFailureCallback_15(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_15(status); + } - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_2() + static void OnSuccessCallback_15(void * context, bool onOff) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_15(onOff); + } - return cluster.ReadAttributeClusterRevision(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + static void OnFailureCallback_16(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_16(status); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_16(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_16(onTime); + } - void OnSuccessResponse_2(uint16_t clusterRevision) + static void OnFailureCallback_17(void * context, uint8_t status) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 4U)); - NextTest(); + (static_cast(context))->OnFailureResponse_17(status); } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_3() + static void OnSuccessCallback_17(void * context, uint16_t offWaitTime) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_17(offWaitTime); + } - return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + static void OnFailureCallback_19(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_19(status); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + static void OnSuccessCallback_19(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_19(onOff); + } - void OnSuccessResponse_3(uint32_t featureMap) + static void OnFailureCallback_20(void * context, uint8_t status) { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); - NextTest(); + (static_cast(context))->OnFailureResponse_20(status); } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_4() + static void OnSuccessCallback_20(void * context, uint16_t onTime) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnSuccessResponse_20(onTime); + } - uint32_t featureMapArgument; - featureMapArgument = 0UL; + static void OnFailureCallback_21(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_21(status); + } - return cluster.WriteAttribute( - featureMapArgument, this, OnSuccessCallback_4, OnFailureCallback_4); + static void OnSuccessCallback_21(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_21(onOff); } - void OnFailureResponse_4(uint8_t status) { NextTest(); } + static void OnFailureCallback_22(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_22(status); + } - void OnSuccessResponse_4() { ThrowSuccessResponse(); } + static void OnSuccessCallback_22(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_22(onTime); + } - CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_5() + static void OnFailureCallback_23(void * context, uint8_t status) { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); + (static_cast(context))->OnFailureResponse_23(status); + } - return cluster.ReadAttributeFeatureMap(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + static void OnSuccessCallback_23(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_23(offWaitTime); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + static void OnFailureCallback_25(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_25(status); + } - void OnSuccessResponse_5(uint32_t featureMap) + static void OnSuccessCallback_25(void * context, uint16_t onTime) { - VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); - NextTest(); + (static_cast(context))->OnSuccessResponse_25(onTime); } -}; -class Test_TC_OO_2_1 : public TestCommand -{ -public: - Test_TC_OO_2_1() : TestCommand("Test_TC_OO_2_1"), mTestIndex(0) {} + static void OnFailureCallback_26(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_26(status); + } - /////////// TestCommand Interface ///////// - void NextTest() override + static void OnSuccessCallback_26(void * context, uint16_t offWaitTime) { - CHIP_ERROR err = CHIP_NO_ERROR; + (static_cast(context))->OnSuccessResponse_26(offWaitTime); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_1\n"); - } + static void OnFailureCallback_28(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_28(status); + } - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + static void OnSuccessCallback_28(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_28(onOff); + } - Wait(); + static void OnFailureCallback_29(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_29(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++) - { - 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; - } + static void OnSuccessCallback_29(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_29(onTime); + } - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + static void OnFailureCallback_30(void * context, uint8_t status) + { + (static_cast(context))->OnFailureResponse_30(status); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - 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_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 }; + static void OnSuccessCallback_30(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_30(onOff); + } - static void OnFailureCallback_0(void * context, uint8_t status) + static void OnFailureCallback_31(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_31(status); } - static void OnSuccessCallback_0(void * context, bool onOff) + static void OnSuccessCallback_31(void * context, uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_0(onOff); + (static_cast(context))->OnSuccessResponse_31(onTime); } - static void OnFailureCallback_1(void * context, uint8_t status) + static void OnFailureCallback_33(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_33(status); } - static void OnSuccessCallback_1(void * context, bool onOff) + static void OnSuccessCallback_33(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_1(onOff); + (static_cast(context))->OnSuccessResponse_33(onOff); } - static void OnFailureCallback_2(void * context, uint8_t status) + static void OnFailureCallback_34(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_34(status); } - static void OnSuccessCallback_2(void * context, bool globalSceneControl) + static void OnSuccessCallback_34(void * context, uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_2(globalSceneControl); + (static_cast(context))->OnSuccessResponse_34(onTime); } - static void OnFailureCallback_3(void * context, uint8_t status) + static void OnFailureCallback_35(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_3(status); + (static_cast(context))->OnFailureResponse_35(status); } - static void OnSuccessCallback_3(void * context, uint16_t onTime) + static void OnSuccessCallback_35(void * context, uint16_t offWaitTime) { - (static_cast(context))->OnSuccessResponse_3(onTime); + (static_cast(context))->OnSuccessResponse_35(offWaitTime); } - static void OnFailureCallback_4(void * context, uint8_t status) + static void OnFailureCallback_37(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_37(status); } - static void OnSuccessCallback_4(void * context, uint16_t offWaitTime) + static void OnSuccessCallback_37(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_4(offWaitTime); + (static_cast(context))->OnSuccessResponse_37(onOff); } - static void OnFailureCallback_5(void * context, uint8_t status) + static void OnFailureCallback_38(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_38(status); } - static void OnSuccessCallback_5(void * context, uint8_t startUpOnOff) + static void OnSuccessCallback_38(void * context, uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_5(startUpOnOff); + (static_cast(context))->OnSuccessResponse_38(onTime); } - static void OnFailureCallback_6(void * context, EmberAfStatus status) + static void OnFailureCallback_39(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_6(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_39(status); } - static void OnSuccessCallback_6(void * context) { (static_cast(context))->OnSuccessResponse_6(); } + static void OnSuccessCallback_39(void * context, bool onOff) + { + (static_cast(context))->OnSuccessResponse_39(onOff); + } - static void OnFailureCallback_7(void * context, EmberAfStatus status) + static void OnFailureCallback_40(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_7(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_40(status); } - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } + static void OnSuccessCallback_40(void * context, uint16_t onTime) + { + (static_cast(context))->OnSuccessResponse_40(onTime); + } - static void OnFailureCallback_8(void * context, EmberAfStatus status) + static void OnFailureCallback_41(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_8(chip::to_underlying(status)); + (static_cast(context))->OnFailureResponse_41(status); } - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } + static void OnSuccessCallback_41(void * context, uint16_t offWaitTime) + { + (static_cast(context))->OnSuccessResponse_41(offWaitTime); + } - static void OnFailureCallback_9(void * context, uint8_t status) + static void OnFailureCallback_42(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_42(status); } - static void OnSuccessCallback_9(void * context, uint16_t onTime) + static void OnSuccessCallback_42(void * context, bool onOff) { - (static_cast(context))->OnSuccessResponse_9(onTime); + (static_cast(context))->OnSuccessResponse_42(onOff); } - static void OnFailureCallback_10(void * context, uint8_t status) + static void OnFailureCallback_43(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_43(status); } - static void OnSuccessCallback_10(void * context, uint16_t offWaitTime) + static void OnSuccessCallback_43(void * context, uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_10(offWaitTime); + (static_cast(context))->OnSuccessResponse_43(onTime); } - static void OnFailureCallback_11(void * context, uint8_t status) + static void OnFailureCallback_44(void * context, uint8_t status) { - (static_cast(context))->OnFailureResponse_11(status); + (static_cast(context))->OnFailureResponse_44(status); } - static void OnSuccessCallback_11(void * context, uint8_t startUpOnOff) + static void OnSuccessCallback_44(void * context, uint16_t offWaitTime) { - (static_cast(context))->OnSuccessResponse_11(startUpOnOff); + (static_cast(context))->OnSuccessResponse_44(offWaitTime); } // // Tests methods // - CHIP_ERROR TestReadTheMandatoryAttributeOnOff_0() + CHIP_ERROR TestSendOnCommand_0() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_0.Cancel(), mOnFailureCallback_0.Cancel()); + 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(bool onOff) + void OnSuccessResponse_0() { NextTest(); } + + CHIP_ERROR TestWait1000ms_1() { return WaitForMs(1000); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_2() { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + } + + void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestReadsBackMandatoryAttributeOnOff_1() + CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_3() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(bool onOff) + void OnSuccessResponse_3(bool globalSceneControl) { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); + VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); NextTest(); } - CHIP_ERROR TestReadLtAttributeGlobalSceneControl_2() + CHIP_ERROR TestSendOnCommand_4() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_2.Cancel(), mOnFailureCallback_2.Cancel()); + 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_4(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_4(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(bool globalSceneControl) + void OnSuccessResponse_4() { NextTest(); } + + CHIP_ERROR TestWait1000ms_5() { return WaitForMs(1000); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_6() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_6.Cancel(), mOnFailureCallback_6.Cancel()); + } + + void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); + } + + CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_7() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + } + + void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(bool globalSceneControl) + { + VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); + NextTest(); + } + + CHIP_ERROR TestSendOnCommand_8() + { + 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_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 TestWait1000ms_9() { return WaitForMs(1000); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_10() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + } + + void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 1)); + NextTest(); + } + + CHIP_ERROR TestReadsGlobalSceneControlAttributeFromDut_11() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeGlobalSceneControl(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + } + + void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11(bool globalSceneControl) { VerifyOrReturn(CheckValue("globalSceneControl", globalSceneControl, 1)); NextTest(); } - CHIP_ERROR TestReadLtAttributeOnTime_3() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_12() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnTime(mOnSuccessCallback_12.Cancel(), mOnFailureCallback_12.Cancel()); + } + + void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_12(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } + + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_13() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); + } + + void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13(uint16_t offWaitTime) + { + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + NextTest(); + } + + CHIP_ERROR TestSendOnCommand_14() + { + 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_14(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_14(status); + }; + return cluster.InvokeCommand(request, this, success, failure); + } + + void OnFailureResponse_14(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_14() { NextTest(); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_15() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnTime(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_15.Cancel(), mOnFailureCallback_15.Cancel()); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_15(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(uint16_t onTime) + void OnSuccessResponse_15(bool onOff) { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestReadLtAttributeOffWaitTime_4() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_16() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_4.Cancel(), mOnFailureCallback_4.Cancel()); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_16.Cancel(), mOnFailureCallback_16.Cancel()); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_16(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint16_t offWaitTime) + void OnSuccessResponse_16(uint16_t onTime) { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); NextTest(); } - CHIP_ERROR TestReadLtAttributeStartUpOnOff_5() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_17() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_17.Cancel(), mOnFailureCallback_17.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_17(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint8_t startUpOnOff) + void OnSuccessResponse_17(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOnTime_6() + CHIP_ERROR TestSendOffCommand_18() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t onTimeArgument; - onTimeArgument = 0U; + using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using responseType = chip::app::DataModel::NullObjectType; - return cluster.WriteAttribute( - onTimeArgument, this, OnSuccessCallback_6, OnFailureCallback_6); + chip::app::Clusters::OnOff::Commands::Off::Type request; + + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_18(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_18(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_18(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_18() { NextTest(); } - CHIP_ERROR TestWriteTheDefaultValueToLtAttributeOffWaitTime_7() + CHIP_ERROR TestReadsOnOffAttributeFromDut_19() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint16_t offWaitTimeArgument; - offWaitTimeArgument = 0U; - - return cluster.WriteAttribute( - offWaitTimeArgument, this, OnSuccessCallback_7, OnFailureCallback_7); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_19.Cancel(), mOnFailureCallback_19.Cancel()); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_19(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7() { NextTest(); } + void OnSuccessResponse_19(bool onOff) + { + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); + } - CHIP_ERROR TestWriteTheDefaultValueToLtAttributeStartUpOnOff_8() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_20() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - uint8_t startUpOnOffArgument; - startUpOnOffArgument = static_cast(0); - - return cluster.WriteAttribute( - startUpOnOffArgument, this, OnSuccessCallback_8, OnFailureCallback_8); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_20.Cancel(), mOnFailureCallback_20.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_20(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8() { NextTest(); } + void OnSuccessResponse_20(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestReadsBackLtAttributeOnTime_9() + CHIP_ERROR TestReadsOnOffAttributeFromDut_21() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnTime(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_21.Cancel(), mOnFailureCallback_21.Cancel()); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_21(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(uint16_t onTime) + void OnSuccessResponse_21(bool onOff) { - VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestReadsBackLtAttributeOffWaitTime_10() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_22() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_10.Cancel(), mOnFailureCallback_10.Cancel()); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_22.Cancel(), mOnFailureCallback_22.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_22(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint16_t offWaitTime) + void OnSuccessResponse_22(uint16_t onTime) { - VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); NextTest(); } - CHIP_ERROR TestReadsBackLtAttributeStartUpOnOff_11() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_23() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeStartUpOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_23.Cancel(), mOnFailureCallback_23.Cancel()); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_23(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11(uint8_t startUpOnOff) + void OnSuccessResponse_23(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("startUpOnOff", startUpOnOff, 0)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } -}; - -class Test_TC_OO_2_2 : public TestCommand -{ -public: - Test_TC_OO_2_2() : TestCommand("Test_TC_OO_2_2"), mTestIndex(0) {} - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestSendOnCommand_24() { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OO_2_2\n"); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OO_2_2\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; + using responseType = chip::app::DataModel::NullObjectType; - Wait(); + chip::app::Clusters::OnOff::Commands::On::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 : Send Off Command\n"); - err = TestSendOffCommand_0(); - break; - case 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; - } + auto success = [](void * context, const responseType & data) { + (static_cast(context))->OnSuccessResponse_24(); + }; - 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_24(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + void OnFailureResponse_24(uint8_t status) { ThrowFailureResponse(); } - 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 }; + void OnSuccessResponse_24() { NextTest(); } - static void OnFailureCallback_1(void * context, uint8_t status) + CHIP_ERROR TestReadsOnTimeAttributeFromDut_25() { - (static_cast(context))->OnFailureResponse_1(status); - } + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); - static void OnSuccessCallback_1(void * context, bool onOff) - { - (static_cast(context))->OnSuccessResponse_1(onOff); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_25.Cancel(), mOnFailureCallback_25.Cancel()); } - static void OnFailureCallback_3(void * context, uint8_t status) + void OnFailureResponse_25(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_25(uint16_t onTime) { - (static_cast(context))->OnFailureResponse_3(status); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); } - static void OnSuccessCallback_3(void * context, bool onOff) + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_26() { - (static_cast(context))->OnSuccessResponse_3(onOff); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_26.Cancel(), mOnFailureCallback_26.Cancel()); } - static void OnFailureCallback_5(void * context, uint8_t status) + void OnFailureResponse_26(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_26(uint16_t offWaitTime) { - (static_cast(context))->OnFailureResponse_5(status); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + NextTest(); } - static void OnSuccessCallback_5(void * context, bool onOff) + CHIP_ERROR TestSendOffCommand_27() { - (static_cast(context))->OnSuccessResponse_5(onOff); + 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_27(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_27(status); + }; + return cluster.InvokeCommand(request, this, success, failure); } - static void OnFailureCallback_7(void * context, uint8_t status) + void OnFailureResponse_27(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_27() { NextTest(); } + + CHIP_ERROR TestReadsOnOffAttributeFromDut_28() { - (static_cast(context))->OnFailureResponse_7(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_28.Cancel(), mOnFailureCallback_28.Cancel()); } - static void OnSuccessCallback_7(void * context, bool onOff) + void OnFailureResponse_28(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_28(bool onOff) { - (static_cast(context))->OnSuccessResponse_7(onOff); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); } - static void OnFailureCallback_9(void * context, uint8_t status) + CHIP_ERROR TestReadsOnTimeAttributeFromDut_29() { - (static_cast(context))->OnFailureResponse_9(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnTime(mOnSuccessCallback_29.Cancel(), mOnFailureCallback_29.Cancel()); } - static void OnSuccessCallback_9(void * context, bool onOff) + void OnFailureResponse_29(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_29(uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_9(onOff); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); } - static void OnFailureCallback_11(void * context, uint8_t status) + CHIP_ERROR TestReadsOnOffAttributeFromDut_30() { - (static_cast(context))->OnFailureResponse_11(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnOff(mOnSuccessCallback_30.Cancel(), mOnFailureCallback_30.Cancel()); } - static void OnSuccessCallback_11(void * context, bool onOff) + void OnFailureResponse_30(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_30(bool onOff) { - (static_cast(context))->OnSuccessResponse_11(onOff); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); + NextTest(); } - static void OnFailureCallback_13(void * context, uint8_t status) + CHIP_ERROR TestReadsOnTimeAttributeFromDut_31() { - (static_cast(context))->OnFailureResponse_13(status); + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOnTime(mOnSuccessCallback_31.Cancel(), mOnFailureCallback_31.Cancel()); } - static void OnSuccessCallback_13(void * context, bool onOff) + void OnFailureResponse_31(uint8_t status) { ThrowFailureResponse(); } + + void OnSuccessResponse_31(uint16_t onTime) { - (static_cast(context))->OnSuccessResponse_13(onOff); + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); } - // - // Tests methods - // - - CHIP_ERROR TestSendOffCommand_0() + CHIP_ERROR TestSendOnCommand_32() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using requestType = chip::app::Clusters::OnOff::Commands::On::Type; using responseType = chip::app::DataModel::NullObjectType; - chip::app::Clusters::OnOff::Commands::Off::Type request; + chip::app::Clusters::OnOff::Commands::On::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_0(); + (static_cast(context))->OnSuccessResponse_32(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_0(status); + (static_cast(context))->OnFailureResponse_32(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_0(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_32(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_0() { NextTest(); } + void OnSuccessResponse_32() { NextTest(); } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_1() + CHIP_ERROR TestReadsOnOffAttributeFromDut_33() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_1.Cancel(), mOnFailureCallback_1.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_33.Cancel(), mOnFailureCallback_33.Cancel()); } - void OnFailureResponse_1(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_33(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(bool onOff) + void OnSuccessResponse_33(bool onOff) { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); + VerifyOrReturn(CheckValue("onOff", onOff, 1)); NextTest(); } - CHIP_ERROR TestSendOnCommand_2() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_34() { 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); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_34.Cancel(), mOnFailureCallback_34.Cancel()); } - void OnFailureResponse_2(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_34(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_2() { NextTest(); } + void OnSuccessResponse_34(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_3() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_35() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_3.Cancel(), mOnFailureCallback_3.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_35.Cancel(), mOnFailureCallback_35.Cancel()); } - void OnFailureResponse_3(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_35(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_3(bool onOff) + void OnSuccessResponse_35(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } - CHIP_ERROR TestSendOffCommand_4() + CHIP_ERROR TestSendOffCommand_36() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); @@ -16216,156 +18863,148 @@ class Test_TC_OO_2_2 : public TestCommand chip::app::Clusters::OnOff::Commands::Off::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_4(); + (static_cast(context))->OnSuccessResponse_36(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnFailureResponse_36(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_4(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_36(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_4() { NextTest(); } + void OnSuccessResponse_36() { NextTest(); } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_5() + CHIP_ERROR TestReadsOnOffAttributeFromDut_37() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_5.Cancel(), mOnFailureCallback_5.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_37.Cancel(), mOnFailureCallback_37.Cancel()); } - void OnFailureResponse_5(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_37(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(bool onOff) + void OnSuccessResponse_37(bool onOff) { VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestSendToggleCommand_6() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_38() { 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_6(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_38.Cancel(), mOnFailureCallback_38.Cancel()); } - void OnFailureResponse_6(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_38(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_38(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterToggleCommand_7() + CHIP_ERROR TestReadsOnOffAttributeFromDut_39() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_7.Cancel(), mOnFailureCallback_7.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_39.Cancel(), mOnFailureCallback_39.Cancel()); } - void OnFailureResponse_7(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_39(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(bool onOff) + void OnSuccessResponse_39(bool onOff) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestSendToggleCommand_8() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_40() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - using requestType = chip::app::Clusters::OnOff::Commands::Toggle::Type; - using responseType = chip::app::DataModel::NullObjectType; + return cluster.ReadAttributeOnTime(mOnSuccessCallback_40.Cancel(), mOnFailureCallback_40.Cancel()); + } - chip::app::Clusters::OnOff::Commands::Toggle::Type request; + void OnFailureResponse_40(uint8_t status) { ThrowFailureResponse(); } - auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_8(); - }; + void OnSuccessResponse_40(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_8(status); - }; - return cluster.InvokeCommand(request, this, success, failure); + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_41() + { + chip::Controller::OnOffClusterTest cluster; + cluster.Associate(mDevice, 1); + + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_41.Cancel(), mOnFailureCallback_41.Cancel()); } - void OnFailureResponse_8(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_41(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_8() { NextTest(); } + void OnSuccessResponse_41(uint16_t offWaitTime) + { + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); + NextTest(); + } - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterToggleCommand_9() + CHIP_ERROR TestReadsOnOffAttributeFromDut_42() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_9.Cancel(), mOnFailureCallback_9.Cancel()); + return cluster.ReadAttributeOnOff(mOnSuccessCallback_42.Cancel(), mOnFailureCallback_42.Cancel()); } - void OnFailureResponse_9(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_42(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(bool onOff) + void OnSuccessResponse_42(bool onOff) { VerifyOrReturn(CheckValue("onOff", onOff, 0)); NextTest(); } - CHIP_ERROR TestSendOnCommand_10() + CHIP_ERROR TestReadsOnTimeAttributeFromDut_43() { 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); + return cluster.ReadAttributeOnTime(mOnSuccessCallback_43.Cancel(), mOnFailureCallback_43.Cancel()); } - void OnFailureResponse_10(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_43(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_10() { NextTest(); } + void OnSuccessResponse_43(uint16_t onTime) + { + VerifyOrReturn(CheckValue("onTime", onTime, 0U)); + NextTest(); + } - CHIP_ERROR TestCheckOnOffAttributeValueIsTrueAfterOnCommand_11() + CHIP_ERROR TestReadsOffWaitTimeAttributeFromDut_44() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); - return cluster.ReadAttributeOnOff(mOnSuccessCallback_11.Cancel(), mOnFailureCallback_11.Cancel()); + return cluster.ReadAttributeOffWaitTime(mOnSuccessCallback_44.Cancel(), mOnFailureCallback_44.Cancel()); } - void OnFailureResponse_11(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_44(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_11(bool onOff) + void OnSuccessResponse_44(uint16_t offWaitTime) { - VerifyOrReturn(CheckValue("onOff", onOff, 1)); + VerifyOrReturn(CheckValue("offWaitTime", offWaitTime, 0U)); NextTest(); } - CHIP_ERROR TestSendOffCommand_12() + CHIP_ERROR TestSendOffCommand_45() { chip::Controller::OnOffClusterTest cluster; cluster.Associate(mDevice, 1); @@ -16376,34 +19015,18 @@ class Test_TC_OO_2_2 : public TestCommand chip::app::Clusters::OnOff::Commands::Off::Type request; auto success = [](void * context, const responseType & data) { - (static_cast(context))->OnSuccessResponse_12(); + (static_cast(context))->OnSuccessResponse_45(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_12(status); + (static_cast(context))->OnFailureResponse_45(status); }; return cluster.InvokeCommand(request, this, success, failure); } - void OnFailureResponse_12(uint8_t status) { ThrowFailureResponse(); } - - void OnSuccessResponse_12() { NextTest(); } - - CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_13() - { - chip::Controller::OnOffClusterTest cluster; - cluster.Associate(mDevice, 1); - - return cluster.ReadAttributeOnOff(mOnSuccessCallback_13.Cancel(), mOnFailureCallback_13.Cancel()); - } - - void OnFailureResponse_13(uint8_t status) { ThrowFailureResponse(); } + void OnFailureResponse_45(uint8_t status) { ThrowFailureResponse(); } - void OnSuccessResponse_13(bool onOff) - { - VerifyOrReturn(CheckValue("onOff", onOff, 0)); - NextTest(); - } + void OnSuccessResponse_45() { NextTest(); } }; class Test_TC_PRS_1_1 : public TestCommand @@ -19916,6 +22539,54 @@ class Test_TC_WNCV_2_1 : public TestCommand } }; +class Test_TC_WNCV_2_2 : public TestCommand +{ +public: + Test_TC_WNCV_2_2() : TestCommand("Test_TC_WNCV_2_2"), mTestIndex(0) {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_2_2\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_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++) + { + } + + 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_WNCV_2_5 : public TestCommand { public: @@ -28252,6 +30923,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -28285,6 +30957,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -28304,6 +30977,7 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),