From 27158dd0c9041d1442b1525b3ffe460d0d380cb7 Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Fri, 14 Apr 2023 12:04:58 -0400 Subject: [PATCH] [Tests] Adding Color Loop set tests for Github CI (#25964) * Add yaml tests for CC color loop * Add new tests to CI * Generated files * PR review comments * Generated files * apply restyle manually * Fix tests * generated files * restyle generation * increase delay for an operation * generated files * increase delay * fix comment * fix generation * fix generation --- .../tests/suites/TestColorControl_9_1.yaml | 769 ++++ .../tests/suites/TestColorControl_9_2.yaml | 314 ++ src/app/tests/suites/ciTests.json | 4 +- .../chip-tool/zap-generated/test/Commands.h | 1610 +++++++++ .../zap-generated/test/Commands.h | 3153 +++++++++++++++++ 5 files changed, 5849 insertions(+), 1 deletion(-) create mode 100644 src/app/tests/suites/TestColorControl_9_1.yaml create mode 100644 src/app/tests/suites/TestColorControl_9_2.yaml diff --git a/src/app/tests/suites/TestColorControl_9_1.yaml b/src/app/tests/suites/TestColorControl_9_1.yaml new file mode 100644 index 00000000000000..8ccf45a35fdb18 --- /dev/null +++ b/src/app/tests/suites/TestColorControl_9_1.yaml @@ -0,0 +1,769 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Copy/ Paste of the TC_CC_9.1 with shorter delays for Github CI only +name: 25.3.24. [TC-CC-9.1] ColorLoopSet Validation + +config: + nodeId: 0x12344321 + timeout: 400 + cluster: "Color Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH writes 0 to the Options attribute" + command: "writeAttribute" + attribute: "Options" + arguments: + value: 0 + + - label: "TH sends On command to DUT" + cluster: "On/Off" + command: "On" + + - label: + "TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, + Direction=0x00 (shortest distance) and TransitionTime=0 (immediately)." + command: "EnhancedMoveToHue" + arguments: + values: + - name: "EnhancedHue" + value: 16384 + - name: "Direction" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Wait for 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x0 (De-activate) to DUT." + 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: "ColorLoopActive" + response: + value: 0 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 + (UpdateDirection) and Direction attribute to 0x0 (decrement hue) to + DUT." + 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: "ColorLoopDirection" + response: + value: 0 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x4 + (UpdateTime) and Time attribute to 5 (5s for one loop) to DUT." + command: "ColorLoopSet" + arguments: + values: + - name: "UpdateFlags" + value: 4 + - name: "Action" + value: 0 + - name: "Direction" + value: 0 + - name: "Time" + value: 5 + - name: "StartHue" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Read ColorLoopTime attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopTime" + response: + value: 5 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x8 + (UpdateStartHue) and StartHue attribute to 0x00A0 to DUT." + 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: "ColorLoopStartEnhancedHue" + response: + value: 160 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x1 (start from + ColorLoopStartEnhancedHue) to DUT." + 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: "ColorLoopActive" + response: + value: 1 + + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + value: 16384 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: + "Saving value for comparison in step 8d read ColorLoopStartEnhancedHue + attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopStartEnhancedHue" + response: + saveAs: ColorLoopStartEnhancedHueStep5d + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueStep5d + maxValue: 65535 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueStep5d + maxValue: 65535 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x0 (De-activate) to DUT" + 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: "ColorLoopActive" + response: + value: 0 + + - label: + "Saving value for comparison in step 6c read + ColorLoopStoredEnhancedHue attribute from DUT." + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + saveAs: ColorLoopStoredEnhancedHueStep6c + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + value: ColorLoopStoredEnhancedHueStep6c + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 + (UpdateDirection) and Direction attribute to 0x1 (increment hue) to + DUT." + 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: "ColorLoopDirection" + response: + value: 1 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x1 (start from + ColorLoopStartEnhancedHue) to DUT." + 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: "ColorLoopActive" + response: + value: 1 + + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + value: 16384 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: + "Saving value for comparision in step 8d read + ColorLoopStartEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopStartEnhancedHue" + response: + saveAs: ColorLoopStartEnhancedHueStep8d + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueStep8d + maxValue: 65535 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueStep8d + maxValue: 65535 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x0 (De-activate) to DUT." + 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: "ColorLoopActive" + response: + value: 0 + + - label: + "Saving value for comparision in step 9c read + ColorLoopStoredEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + saveAs: ColorLoopStoredEnhancedHueStep9c + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + value: ColorLoopStoredEnhancedHueStep9c + + - label: + "TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, + Direction=0x00 (shortest distance) and TransitionTime=0 (immediately)." + command: "EnhancedMoveToHue" + arguments: + values: + - name: "EnhancedHue" + value: 16384 + - name: "Direction" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Wait 10ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10 + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + value: 16384 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 + (UpdateDirection) and Direction attribute to 0x0 (decrement hue) to + DUT." + 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: "ColorLoopDirection" + response: + value: 0 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x2 (start from + EnhancedCurrentHue) to DUT." + 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: "ColorLoopActive" + response: + value: 1 + + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + value: 16384 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: + "Saving value for comparision in step 12d read + ColorLoopStartEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopStartEnhancedHue" + response: + saveAs: ColorLoopStartEnhancedHueStep12d + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueStep12d + maxValue: 65535 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueStep12d + maxValue: 65535 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x0 (De-activate) to DUT." + 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: "ColorLoopActive" + response: + value: 0 + + - label: + "Saving value for comparision in step 13c read + ColorLoopStoredEnhancedHue attribute from DUT." + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + saveAs: ColorLoopStoredEnhancedHueStep13c + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + value: ColorLoopStoredEnhancedHueStep13c + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 + (UpdateDirection) and Direction attribute to 0x1 (increment hue) to + DUT." + 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: "ColorLoopDirection" + response: + value: 1 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x2 (start from + EnhancedCurrentHue) to DUT" + 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: "ColorLoopActive" + response: + value: 1 + + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + value: 16384 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: + "Saving value for comparision in step 15d read + ColorLoopStartEnhancedHue attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopStartEnhancedHue" + response: + saveAs: ColorLoopStartEnhancedHueStep15d + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueStep15d + maxValue: 65535 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueStep15d + maxValue: 65535 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x0 (De-activate) to DUT." + 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: "ColorLoopActive" + response: + value: 0 + + - label: + "Saving value for comparision in step 16b read + ColorLoopStoredEnhancedHue attribute from DUT." + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + saveAs: ColorLoopStoredEnhancedHueStep16b + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + value: ColorLoopStoredEnhancedHueStep16b + + - label: "Turn Off light for color control tests" + cluster: "On/Off" + command: "Off" + + - label: "Check on/off attribute value is false after off command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 diff --git a/src/app/tests/suites/TestColorControl_9_2.yaml b/src/app/tests/suites/TestColorControl_9_2.yaml new file mode 100644 index 00000000000000..21e501ced547a9 --- /dev/null +++ b/src/app/tests/suites/TestColorControl_9_2.yaml @@ -0,0 +1,314 @@ +# 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. + +# Copy/ Paste of the TC_CC_9.2 with shorter delays for Github CI only +name: 27.2.21. [TC-CC-9.2] ColorLoopSet Validation - change direction without + stop + + - CC.S + +config: + nodeId: 0x12344321 + cluster: "Color Control" + endpoint: 1 + timeout: 400 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH writes 0 to the Options attribute" + command: "writeAttribute" + attribute: "Options" + arguments: + value: 0 + + - label: "TH sends On command to DUT" + cluster: "On/Off" + command: "On" + + - label: + "TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, + Direction=0x00 (shortest distance) and TransitionTime=0 (immediately)." + command: "EnhancedMoveToHue" + arguments: + values: + - name: "EnhancedHue" + value: 16384 + - name: "Direction" + value: 0 + - name: "TransitionTime" + value: 0 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Wait for 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0xF, + Action attribute to 0x0 (De-activate), Direction attribute to 0x0 + (decrement hue), Time attribute to 30, and StartHue attribute to + 0x00A0 to DUT." + command: "ColorLoopSet" + arguments: + values: + - name: "UpdateFlags" + value: 15 + - name: "Action" + value: 0 + - name: "Direction" + value: 0 + - name: "Time" + value: 5 + - name: "StartHue" + value: 160 + - name: "OptionsMask" + value: 0 + - name: "OptionsOverride" + value: 0 + + - label: "Read ColorLoopActive attribute from DUT" + command: "readAttribute" + attribute: "ColorLoopActive" + response: + value: 0 + + - label: "Read ColorLoopDirection attribute from DUT." + command: "readAttribute" + attribute: "ColorLoopDirection" + response: + value: 0 + + - label: "Read ColorLoopTime attribute from DUT." + command: "readAttribute" + attribute: "ColorLoopTime" + response: + value: 5 + + - label: "Read ColorLoopStartEnhancedHue attribute from DUT." + command: "readAttribute" + attribute: "ColorLoopStartEnhancedHue" + response: + value: 160 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x1 (start from + ColorLoopStartEnhancedHue) to DUT." + 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: "ColorLoopActive" + response: + value: 1 + + - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + value: 16384 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: + "Saving value for comparision read ColorLoopStartEnhancedHue attribute + from DUT." + command: "readAttribute" + attribute: "ColorLoopStartEnhancedHue" + response: + saveAs: ColorLoopStartEnhancedHueValue + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueValue + maxValue: 65535 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHueValue + maxValue: 65535 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 + (UpdateDirection) and Direction attribute to 0x1 (increment hue) to + DUT." + 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: "ColorLoopDirection" + response: + value: 1 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: + "Saving value for comparision read ColorLoopStartEnhancedHue attribute + from DUT." + command: "readAttribute" + attribute: "ColorLoopStartEnhancedHue" + response: + saveAs: ColorLoopStartEnhancedHue + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHue + maxValue: 65535 + + - label: "Wait for 5S" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 5000 + + - label: "Read EnhancedCurrentHue attribute from DUT" + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + constraints: + type: int16u + minValue: ColorLoopStartEnhancedHue + maxValue: 65535 + + - label: + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 + (UpdateAction) and Action attribute to 0x0 (De-activate) to DUT." + 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: "ColorLoopActive" + response: + value: 0 + + - label: + "Saving value for comparision read ColorLoopStoredEnhancedHue + attribute from DUT." + command: "readAttribute" + attribute: "ColorLoopStoredEnhancedHue" + response: + saveAs: ColorLoopStoredEnhancedHueValue + + - label: "Read EnhancedCurrentHue attribute from DUT." + command: "readAttribute" + attribute: "EnhancedCurrentHue" + response: + value: ColorLoopStoredEnhancedHueValue + + - label: "Turn off light for color control tests" + cluster: "On/Off" + command: "Off" + + - label: "Check on/off attribute value is false after off command" + cluster: "On/Off" + command: "readAttribute" + attribute: "OnOff" + response: + value: 0 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index dc88eb149ea72c..deb6fce3dd5ba4 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -34,7 +34,9 @@ "Test_TC_CC_7_2", "Test_TC_CC_7_3", "Test_TC_CC_7_4", - "Test_TC_CC_8_1" + "Test_TC_CC_8_1", + "TestColorControl_9_1", + "TestColorControl_9_2" ], "DeviceManagement": [ "Test_TC_OPCREDS_1_2", diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 88161ae0aa880c..1666169997e780 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -69,6 +69,8 @@ class TestList : public Command printf("Test_TC_CC_7_3\n"); printf("Test_TC_CC_7_4\n"); printf("Test_TC_CC_8_1\n"); + printf("TestColorControl_9_1\n"); + printf("TestColorControl_9_2\n"); printf("Test_TC_OPCREDS_1_2\n"); printf("Test_TC_BINFO_1_1\n"); printf("Test_TC_BINFO_2_1\n"); @@ -18686,6 +18688,1612 @@ class Test_TC_CC_8_1Suite : public TestCommand } }; +class TestColorControl_9_1Suite : public TestCommand +{ +public: + TestColorControl_9_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestColorControl_9_1", 72, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~TestColorControl_9_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } + +private: + chip::Optional mNodeId; + chip::Optional mTimeout; + chip::Optional mCluster; + chip::Optional mEndpoint; + + uint16_t ColorLoopStartEnhancedHueStep5d; + uint16_t ColorLoopStoredEnhancedHueStep6c; + uint16_t ColorLoopStartEnhancedHueStep8d; + uint16_t ColorLoopStoredEnhancedHueStep9c; + uint16_t ColorLoopStartEnhancedHueStep12d; + uint16_t ColorLoopStoredEnhancedHueStep13c; + uint16_t ColorLoopStartEnhancedHueStep15d; + uint16_t ColorLoopStoredEnhancedHueStep16b; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 0U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopTime", value, 5U)); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStartEnhancedHueStep5d = value; + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueStep5d)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueStep5d)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStoredEnhancedHueStep6c = value; + } + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep6c)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 1U)); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); + } + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); + } + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStartEnhancedHueStep8d = value; + } + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueStep8d)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueStep8d)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); + } + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStoredEnhancedHueStep9c = value; + } + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep9c)); + } + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, 16384U)); + } + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 0U)); + } + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); + } + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); + } + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStartEnhancedHueStep12d = value; + } + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueStep12d)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueStep12d)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); + } + break; + case 54: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStoredEnhancedHueStep13c = value; + } + break; + case 55: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep13c)); + } + break; + case 56: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 57: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 1U)); + } + break; + case 58: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 59: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); + } + break; + case 60: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); + } + break; + case 61: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 62: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStartEnhancedHueStep15d = value; + } + break; + case 63: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueStep15d)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 64: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 65: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueStep15d)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 66: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 67: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); + } + break; + case 68: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStoredEnhancedHueStep16b = value; + } + break; + case 69: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueStep16b)); + } + break; + case 70: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 71: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH writes 0 to the Options attribute"); + ListFreer listFreer; + uint8_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 2: { + LogStep(2, "TH sends On command to DUT"); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional + + ); + } + case 3: { + LogStep(3, + "TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest distance) and " + "TransitionTime=0 (immediately)."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; + value.enhancedHue = 16384U; + value.direction = static_cast(0); + value.transitionTime = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, + value, chip::NullOptional + + ); + } + case 4: { + LogStep(4, "Wait for 100ms"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 100UL; + return WaitForMs(kIdentityAlpha, value); + } + case 5: { + LogStep(5, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " + "(De-activate) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 6: { + LogStep(6, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 7: { + LogStep(7, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " + "to 0x0 (decrement hue) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 8: { + LogStep(8, "Read ColorLoopDirection attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, + true, chip::NullOptional); + } + case 9: { + LogStep(9, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x4 (UpdateTime) and Time attribute to 5 (5s " + "for one loop) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(4U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 5U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 10: { + LogStep(10, "Read ColorLoopTime attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, + true, chip::NullOptional); + } + case 11: { + LogStep(11, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x8 (UpdateStartHue) and StartHue attribute to " + "0x00A0 to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(8U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 160U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 12: { + LogStep(12, "Read ColorLoopStartEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x1 " + "(start from ColorLoopStartEnhancedHue) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(1); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 14: { + LogStep(14, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read ColorLoopStoredEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 16: { + LogStep(16, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 17: { + LogStep(17, "Saving value for comparison in step 8d read ColorLoopStartEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); + } + case 18: { + LogStep(18, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 19: { + LogStep(19, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 20: { + LogStep(20, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 21: { + LogStep(21, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " + "(De-activate) to DUT"); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 22: { + LogStep(22, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 23: { + LogStep(23, "Saving value for comparison in step 6c read ColorLoopStoredEnhancedHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 24: { + LogStep(24, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 25: { + LogStep(25, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " + "to 0x1 (increment hue) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2U); + value.action = static_cast(0); + value.direction = static_cast(1); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 26: { + LogStep(26, "Read ColorLoopDirection attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, + true, chip::NullOptional); + } + case 27: { + LogStep(27, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x1 " + "(start from ColorLoopStartEnhancedHue) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(1); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 28: { + LogStep(28, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 29: { + LogStep(29, "Read ColorLoopStoredEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 30: { + LogStep(30, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 31: { + LogStep(31, "Saving value for comparision in step 8d read ColorLoopStartEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); + } + case 32: { + LogStep(32, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 33: { + LogStep(33, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 34: { + LogStep(34, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 35: { + LogStep(35, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " + "(De-activate) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 36: { + LogStep(36, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 37: { + LogStep(37, "Saving value for comparision in step 9c read ColorLoopStoredEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 38: { + LogStep(38, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 39: { + LogStep(39, + "TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest distance) and " + "TransitionTime=0 (immediately)."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; + value.enhancedHue = 16384U; + value.direction = static_cast(0); + value.transitionTime = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, + value, chip::NullOptional + + ); + } + case 40: { + LogStep(40, "Wait 10ms"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10UL; + return WaitForMs(kIdentityAlpha, value); + } + case 41: { + LogStep(41, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 42: { + LogStep(42, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " + "to 0x0 (decrement hue) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 43: { + LogStep(43, "Read ColorLoopDirection attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, + true, chip::NullOptional); + } + case 44: { + LogStep(44, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x2 " + "(start from EnhancedCurrentHue) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(2); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 45: { + LogStep(45, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 46: { + LogStep(46, "Read ColorLoopStoredEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 47: { + LogStep(47, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 48: { + LogStep(48, "Saving value for comparision in step 12d read ColorLoopStartEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); + } + case 49: { + LogStep(49, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 50: { + LogStep(50, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 51: { + LogStep(51, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 52: { + LogStep(52, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " + "(De-activate) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 53: { + LogStep(53, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 54: { + LogStep(54, "Saving value for comparision in step 13c read ColorLoopStoredEnhancedHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 55: { + LogStep(55, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 56: { + LogStep(56, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " + "to 0x1 (increment hue) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2U); + value.action = static_cast(0); + value.direction = static_cast(1); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 57: { + LogStep(57, "Read ColorLoopDirection attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, + true, chip::NullOptional); + } + case 58: { + LogStep(58, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x2 " + "(start from EnhancedCurrentHue) to DUT"); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(2); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 59: { + LogStep(59, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 60: { + LogStep(60, "Read ColorLoopStoredEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 61: { + LogStep(61, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 62: { + LogStep(62, "Saving value for comparision in step 15d read ColorLoopStartEnhancedHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); + } + case 63: { + LogStep(63, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 64: { + LogStep(64, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 65: { + LogStep(65, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 66: { + LogStep(66, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " + "(De-activate) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 67: { + LogStep(67, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 68: { + LogStep(68, "Saving value for comparision in step 16b read ColorLoopStoredEnhancedHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 69: { + LogStep(69, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 70: { + LogStep(70, "Turn Off light for color control tests"); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional + + ); + } + case 71: { + LogStep(71, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class TestColorControl_9_2Suite : public TestCommand +{ +public: + TestColorControl_9_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestColorControl_9_2", 31, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~TestColorControl_9_2Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + uint16_t ColorLoopStartEnhancedHueValue; + uint16_t ColorLoopStartEnhancedHue; + uint16_t ColorLoopStoredEnhancedHueValue; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 0U)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopTime", value, 5U)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", value, 160U)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 1U)); + } + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", value, 16384U)); + } + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStartEnhancedHueValue = value; + } + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHueValue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopDirection", value, 1U)); + } + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStartEnhancedHue = value; + } + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue("value", value, ColorLoopStartEnhancedHue)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 65535U)); + } + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint8_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("colorLoopActive", value, 0U)); + } + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + ColorLoopStoredEnhancedHueValue = value; + } + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("enhancedCurrentHue", value, ColorLoopStoredEnhancedHueValue)); + } + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("onOff", value, 0)); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH writes 0 to the Options attribute"); + ListFreer listFreer; + uint8_t value; + value = 0U; + return WriteAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::Options::Id, value, + chip::NullOptional, chip::NullOptional); + } + case 2: { + LogStep(2, "TH sends On command to DUT"); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::On::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::On::Id, value, chip::NullOptional + + ); + } + case 3: { + LogStep(3, + "TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest distance) and " + "TransitionTime=0 (immediately)."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type value; + value.enhancedHue = 16384U; + value.direction = static_cast(0); + value.transitionTime = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::EnhancedMoveToHue::Id, + value, chip::NullOptional + + ); + } + case 4: { + LogStep(4, "Wait for 100ms"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 100UL; + return WaitForMs(kIdentityAlpha, value); + } + case 5: { + LogStep(5, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0xF, Action attribute to 0x0 (De-activate), " + "Direction attribute to 0x0 (decrement hue), Time attribute to 30, and StartHue attribute to 0x00A0 to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(15U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 5U; + value.startHue = 160U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 6: { + LogStep(6, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read ColorLoopDirection attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, + true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read ColorLoopTime attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopTime::Id, + true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read ColorLoopStartEnhancedHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x1 " + "(start from ColorLoopStartEnhancedHue) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(1); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 11: { + LogStep(11, "Read ColorLoopActive attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 12: { + LogStep(12, "Read ColorLoopStoredEnhancedHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 13: { + LogStep(13, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 14: { + LogStep(14, "Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); + } + case 15: { + LogStep(15, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 16: { + LogStep(16, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 17: { + LogStep(17, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 18: { + LogStep(18, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and Direction attribute " + "to 0x1 (increment hue) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(2U); + value.action = static_cast(0); + value.direction = static_cast(1); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 19: { + LogStep(19, "Read ColorLoopDirection attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopDirection::Id, + true, chip::NullOptional); + } + case 20: { + LogStep(20, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 21: { + LogStep(21, "Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStartEnhancedHue::Id, true, chip::NullOptional); + } + case 22: { + LogStep(22, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 23: { + LogStep(23, "Wait for 5S"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs(kIdentityAlpha, value); + } + case 24: { + LogStep(24, "Read EnhancedCurrentHue attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 25: { + LogStep(25, + "TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action attribute to 0x0 " + "(De-activate) to DUT."); + ListFreer listFreer; + chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type value; + value.updateFlags = static_cast>(1U); + value.action = static_cast(0); + value.direction = static_cast(0); + value.time = 0U; + value.startHue = 0U; + value.optionsMask = 0U; + value.optionsOverride = 0U; + return SendCommand(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Commands::ColorLoopSet::Id, value, + chip::NullOptional + + ); + } + case 26: { + LogStep(26, "Read ColorLoopActive attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::ColorLoopActive::Id, + true, chip::NullOptional); + } + case 27: { + LogStep(27, "Saving value for comparision read ColorLoopStoredEnhancedHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, + ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id, true, chip::NullOptional); + } + case 28: { + LogStep(28, "Read EnhancedCurrentHue attribute from DUT."); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ColorControl::Id, ColorControl::Attributes::EnhancedCurrentHue::Id, + true, chip::NullOptional); + } + case 29: { + LogStep(29, "Turn off light for color control tests"); + ListFreer listFreer; + chip::app::Clusters::OnOff::Commands::Off::Type value; + return SendCommand(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Commands::Off::Id, value, chip::NullOptional + + ); + } + case 30: { + LogStep(30, "Check on/off attribute value is false after off command"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OnOff::Id, OnOff::Attributes::OnOff::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + class Test_TC_OPCREDS_1_2Suite : public TestCommand { public: @@ -112603,6 +114211,8 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 44bd2cbae17798..391eef964a706e 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -61,6 +61,8 @@ class TestList : public Command { printf("Test_TC_CC_6_1\n"); printf("Test_TC_CC_7_3\n"); printf("Test_TC_CC_7_4\n"); + printf("TestColorControl_9_1\n"); + printf("TestColorControl_9_2\n"); printf("Test_TC_OPCREDS_1_2\n"); printf("Test_TC_BINFO_1_1\n"); printf("Test_TC_CNET_1_3\n"); @@ -20891,6 +20893,3155 @@ class Test_TC_CC_7_4 : public TestCommandBridge { } }; +class TestColorControl_9_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + TestColorControl_9_1() + : TestCommandBridge("TestColorControl_9_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~TestColorControl_9_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: TestColorControl_9_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: TestColorControl_9_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH writes 0 to the Options attribute\n"); + err = TestThWrites0ToTheOptionsAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH sends On command to DUT\n"); + err = TestThSendsOnCommandToDut_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest " + "distance) and TransitionTime=0 (immediately).\n"); + err = TestThSendsEnhancedMoveToHueCommandToDutWithEnhancedHue0x4000Direction0x00ShortestDistanceAndTransitionTime0Immediately_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Wait for 100ms\n"); + err = TestWaitFor100ms_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x0 (De-activate) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + "Direction attribute to 0x0 (decrement hue) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x0DecrementHueToDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, + " ***** Test Step 9 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x4 (UpdateTime) and Time " + "attribute to 5 (5s for one loop) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x4UpdateTimeAndTimeAttributeTo55sForOneLoopToDut_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 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x8 (UpdateStartHue) and " + "StartHue attribute to 0x00A0 to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x8UpdateStartHueAndStartHueAttributeTo0x00A0ToDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopStartEnhancedHue attribute from DUT\n"); + err = TestReadColorLoopStartEnhancedHueAttributeFromDut_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x1StartFromColorLoopStartEnhancedHueToDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read ColorLoopStoredEnhancedHue attribute from DUT\n"); + err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Wait for 5S\n"); + err = TestWaitFor5s_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : Saving value for comparison in step 8d read ColorLoopStartEnhancedHue attribute from DUT\n"); + err = TestSavingValueForComparisonInStep8dReadColorLoopStartEnhancedHueAttributeFromDut_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Wait for 5S\n"); + err = TestWaitFor5s_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x0 (De-activate) to DUT\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_22(); + break; + case 23: + ChipLogProgress(chipTool, + " ***** Test Step 23 : Saving value for comparison in step 6c read ColorLoopStoredEnhancedHue attribute from " + "DUT.\n"); + err = TestSavingValueForComparisonInStep6cReadColorLoopStoredEnhancedHueAttributeFromDut_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_24(); + break; + case 25: + ChipLogProgress(chipTool, + " ***** Test Step 25 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + "Direction attribute to 0x1 (increment hue) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x1IncrementHueToDut_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_26(); + break; + case 27: + ChipLogProgress(chipTool, + " ***** Test Step 27 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x1StartFromColorLoopStartEnhancedHueToDut_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 : Read ColorLoopStoredEnhancedHue attribute from DUT\n"); + err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : Wait for 5S\n"); + err = TestWaitFor5s_30(); + break; + case 31: + ChipLogProgress(chipTool, + " ***** Test Step 31 : Saving value for comparision in step 8d read ColorLoopStartEnhancedHue attribute from " + "DUT\n"); + err = TestSavingValueForComparisionInStep8dReadColorLoopStartEnhancedHueAttributeFromDut_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_32(); + break; + case 33: + ChipLogProgress(chipTool, " ***** Test Step 33 : Wait for 5S\n"); + err = TestWaitFor5s_33(); + break; + case 34: + ChipLogProgress(chipTool, " ***** Test Step 34 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_34(); + break; + case 35: + ChipLogProgress(chipTool, + " ***** Test Step 35 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x0 (De-activate) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_35(); + break; + case 36: + ChipLogProgress(chipTool, " ***** Test Step 36 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_36(); + break; + case 37: + ChipLogProgress(chipTool, + " ***** Test Step 37 : Saving value for comparision in step 9c read ColorLoopStoredEnhancedHue attribute from " + "DUT\n"); + err = TestSavingValueForComparisionInStep9cReadColorLoopStoredEnhancedHueAttributeFromDut_37(); + break; + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_38(); + break; + case 39: + ChipLogProgress(chipTool, + " ***** Test Step 39 : TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest " + "distance) and TransitionTime=0 (immediately).\n"); + err = TestThSendsEnhancedMoveToHueCommandToDutWithEnhancedHue0x4000Direction0x00ShortestDistanceAndTransitionTime0Immediately_39(); + break; + case 40: + ChipLogProgress(chipTool, " ***** Test Step 40 : Wait 10ms\n"); + err = TestWait10ms_40(); + break; + case 41: + ChipLogProgress(chipTool, " ***** Test Step 41 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_41(); + break; + case 42: + ChipLogProgress(chipTool, + " ***** Test Step 42 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + "Direction attribute to 0x0 (decrement hue) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x0DecrementHueToDut_42(); + break; + case 43: + ChipLogProgress(chipTool, " ***** Test Step 43 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_43(); + break; + case 44: + ChipLogProgress(chipTool, + " ***** Test Step 44 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x2 (start from EnhancedCurrentHue) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x2StartFromEnhancedCurrentHueToDut_44(); + break; + case 45: + ChipLogProgress(chipTool, " ***** Test Step 45 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_45(); + break; + case 46: + ChipLogProgress(chipTool, " ***** Test Step 46 : Read ColorLoopStoredEnhancedHue attribute from DUT\n"); + err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_46(); + break; + case 47: + ChipLogProgress(chipTool, " ***** Test Step 47 : Wait for 5S\n"); + err = TestWaitFor5s_47(); + break; + case 48: + ChipLogProgress(chipTool, + " ***** Test Step 48 : Saving value for comparision in step 12d read ColorLoopStartEnhancedHue attribute from " + "DUT\n"); + err = TestSavingValueForComparisionInStep12dReadColorLoopStartEnhancedHueAttributeFromDut_48(); + break; + case 49: + ChipLogProgress(chipTool, " ***** Test Step 49 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_49(); + break; + case 50: + ChipLogProgress(chipTool, " ***** Test Step 50 : Wait for 5S\n"); + err = TestWaitFor5s_50(); + break; + case 51: + ChipLogProgress(chipTool, " ***** Test Step 51 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_51(); + break; + case 52: + ChipLogProgress(chipTool, + " ***** Test Step 52 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x0 (De-activate) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_52(); + break; + case 53: + ChipLogProgress(chipTool, " ***** Test Step 53 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_53(); + break; + case 54: + ChipLogProgress(chipTool, + " ***** Test Step 54 : Saving value for comparision in step 13c read ColorLoopStoredEnhancedHue attribute from " + "DUT.\n"); + err = TestSavingValueForComparisionInStep13cReadColorLoopStoredEnhancedHueAttributeFromDut_54(); + break; + case 55: + ChipLogProgress(chipTool, " ***** Test Step 55 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_55(); + break; + case 56: + ChipLogProgress(chipTool, + " ***** Test Step 56 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + "Direction attribute to 0x1 (increment hue) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x1IncrementHueToDut_56(); + break; + case 57: + ChipLogProgress(chipTool, " ***** Test Step 57 : Read ColorLoopDirection attribute from DUT\n"); + err = TestReadColorLoopDirectionAttributeFromDut_57(); + break; + case 58: + ChipLogProgress(chipTool, + " ***** Test Step 58 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x2 (start from EnhancedCurrentHue) to DUT\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x2StartFromEnhancedCurrentHueToDut_58(); + break; + case 59: + ChipLogProgress(chipTool, " ***** Test Step 59 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_59(); + break; + case 60: + ChipLogProgress(chipTool, " ***** Test Step 60 : Read ColorLoopStoredEnhancedHue attribute from DUT\n"); + err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_60(); + break; + case 61: + ChipLogProgress(chipTool, " ***** Test Step 61 : Wait for 5S\n"); + err = TestWaitFor5s_61(); + break; + case 62: + ChipLogProgress(chipTool, + " ***** Test Step 62 : Saving value for comparision in step 15d read ColorLoopStartEnhancedHue attribute from " + "DUT\n"); + err = TestSavingValueForComparisionInStep15dReadColorLoopStartEnhancedHueAttributeFromDut_62(); + break; + case 63: + ChipLogProgress(chipTool, " ***** Test Step 63 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_63(); + break; + case 64: + ChipLogProgress(chipTool, " ***** Test Step 64 : Wait for 5S\n"); + err = TestWaitFor5s_64(); + break; + case 65: + ChipLogProgress(chipTool, " ***** Test Step 65 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_65(); + break; + case 66: + ChipLogProgress(chipTool, + " ***** Test Step 66 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x0 (De-activate) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_66(); + break; + case 67: + ChipLogProgress(chipTool, " ***** Test Step 67 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_67(); + break; + case 68: + ChipLogProgress(chipTool, + " ***** Test Step 68 : Saving value for comparision in step 16b read ColorLoopStoredEnhancedHue attribute from " + "DUT.\n"); + err = TestSavingValueForComparisionInStep16bReadColorLoopStoredEnhancedHueAttributeFromDut_68(); + break; + case 69: + ChipLogProgress(chipTool, " ***** Test Step 69 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_69(); + break; + case 70: + ChipLogProgress(chipTool, " ***** Test Step 70 : Turn Off light for color control tests\n"); + err = TestTurnOffLightForColorControlTests_70(); + break; + case 71: + ChipLogProgress(chipTool, " ***** Test Step 71 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_71(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 39: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 40: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 41: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 42: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 43: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 44: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 45: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 46: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 47: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 48: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 49: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 50: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 51: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 52: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 53: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 54: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 55: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 56: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 57: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 58: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 59: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 60: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 61: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 62: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 63: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 64: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 65: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 66: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 67: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 68: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 69: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 70: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 71: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 72; + + chip::Optional mNodeId; + chip::Optional mTimeout; + chip::Optional mCluster; + chip::Optional mEndpoint; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThWrites0ToTheOptionsAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id optionsArgument; + optionsArgument = [NSNumber numberWithUnsignedChar:0U]; + [cluster writeAttributeOptionsWithValue:optionsArgument + completion:^(NSError * _Nullable err) { + NSLog(@"TH writes 0 to the Options attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsOnCommandToDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster onWithCompletion:^(NSError * _Nullable err) { + NSLog(@"TH sends On command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsEnhancedMoveToHueCommandToDutWithEnhancedHue0x4000Direction0x00ShortestDistanceAndTransitionTime0Immediately_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterEnhancedMoveToHueParams alloc] init]; + params.enhancedHue = [NSNumber numberWithUnsignedShort:16384U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster enhancedMoveToHueWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 " + @"(shortest distance) and TransitionTime=0 (immediately). Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor100ms_4() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 100UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x0 (De-activate) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x0DecrementHueToDut_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:2U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + @"Direction attribute to 0x0 (decrement hue) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopDirection", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x4UpdateTimeAndTimeAttributeTo55sForOneLoopToDut_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:4U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:5U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x4 (UpdateTime) and Time " + @"attribute to 5 (5s for one loop) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopTime attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopTime", actualValue, 5U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x8UpdateStartHueAndStartHueAttributeTo0x00A0ToDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:8U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:160U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x8 (UpdateStartHue) and " + @"StartHue attribute to 0x00A0 to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopStartEnhancedHue", actualValue, 160U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x1StartFromColorLoopStartEnhancedHueToDut_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:1U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopStoredEnhancedHue", actualValue, 16384U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_16() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + NSNumber * _Nonnull ColorLoopStartEnhancedHueStep5d; + + CHIP_ERROR TestSavingValueForComparisonInStep8dReadColorLoopStartEnhancedHueAttributeFromDut_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparison in step 8d read ColorLoopStartEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStartEnhancedHueStep5d = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueStep5d)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_19() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueStep5d)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x0 (De-activate) to DUT Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull ColorLoopStoredEnhancedHueStep6c; + + CHIP_ERROR TestSavingValueForComparisonInStep6cReadColorLoopStoredEnhancedHueAttributeFromDut_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparison in step 6c read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStoredEnhancedHueStep6c = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EnhancedCurrentHue", actualValue, ColorLoopStoredEnhancedHueStep6c)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x1IncrementHueToDut_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:2U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:1U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + @"Direction attribute to 0x1 (increment hue) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopDirection", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x1StartFromColorLoopStartEnhancedHueToDut_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:1U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_28() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_29() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopStoredEnhancedHue", actualValue, 16384U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_30() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + NSNumber * _Nonnull ColorLoopStartEnhancedHueStep8d; + + CHIP_ERROR TestSavingValueForComparisionInStep8dReadColorLoopStartEnhancedHueAttributeFromDut_31() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparision in step 8d read ColorLoopStartEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStartEnhancedHueStep8d = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_32() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueStep8d)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_33() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_34() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueStep8d)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_35() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x0 (De-activate) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_36() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull ColorLoopStoredEnhancedHueStep9c; + + CHIP_ERROR TestSavingValueForComparisionInStep9cReadColorLoopStoredEnhancedHueAttributeFromDut_37() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparision in step 9c read ColorLoopStoredEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStoredEnhancedHueStep9c = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_38() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EnhancedCurrentHue", actualValue, ColorLoopStoredEnhancedHueStep9c)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsEnhancedMoveToHueCommandToDutWithEnhancedHue0x4000Direction0x00ShortestDistanceAndTransitionTime0Immediately_39() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterEnhancedMoveToHueParams alloc] init]; + params.enhancedHue = [NSNumber numberWithUnsignedShort:16384U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster enhancedMoveToHueWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 " + @"(shortest distance) and TransitionTime=0 (immediately). Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWait10ms_40() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 10UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_41() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EnhancedCurrentHue", actualValue, 16384U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x0DecrementHueToDut_42() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:2U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + @"Direction attribute to 0x0 (decrement hue) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_43() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopDirection", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x2StartFromEnhancedCurrentHueToDut_44() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:2U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x2 (start from EnhancedCurrentHue) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_45() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_46() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopStoredEnhancedHue", actualValue, 16384U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_47() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + NSNumber * _Nonnull ColorLoopStartEnhancedHueStep12d; + + CHIP_ERROR TestSavingValueForComparisionInStep12dReadColorLoopStartEnhancedHueAttributeFromDut_48() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparision in step 12d read ColorLoopStartEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStartEnhancedHueStep12d = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_49() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueStep12d)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_50() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_51() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueStep12d)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_52() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x0 (De-activate) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_53() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull ColorLoopStoredEnhancedHueStep13c; + + CHIP_ERROR TestSavingValueForComparisionInStep13cReadColorLoopStoredEnhancedHueAttributeFromDut_54() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparision in step 13c read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStoredEnhancedHueStep13c = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_55() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EnhancedCurrentHue", actualValue, ColorLoopStoredEnhancedHueStep13c)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x1IncrementHueToDut_56() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:2U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:1U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + @"Direction attribute to 0x1 (increment hue) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_57() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopDirection attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopDirection", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x2StartFromEnhancedCurrentHueToDut_58() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:2U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x2 (start from EnhancedCurrentHue) to DUT Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_59() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_60() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopStoredEnhancedHue", actualValue, 16384U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_61() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + NSNumber * _Nonnull ColorLoopStartEnhancedHueStep15d; + + CHIP_ERROR TestSavingValueForComparisionInStep15dReadColorLoopStartEnhancedHueAttributeFromDut_62() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparision in step 15d read ColorLoopStartEnhancedHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStartEnhancedHueStep15d = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_63() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueStep15d)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_64() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_65() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueStep15d)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_66() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x0 (De-activate) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_67() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull ColorLoopStoredEnhancedHueStep16b; + + CHIP_ERROR TestSavingValueForComparisionInStep16bReadColorLoopStoredEnhancedHueAttributeFromDut_68() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparision in step 16b read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStoredEnhancedHueStep16b = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_69() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EnhancedCurrentHue", actualValue, ColorLoopStoredEnhancedHueStep16b)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTurnOffLightForColorControlTests_70() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster offWithCompletion:^(NSError * _Nullable err) { + NSLog(@"Turn Off light for color control tests Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_71() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class TestColorControl_9_2 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + TestColorControl_9_2() + : TestCommandBridge("TestColorControl_9_2") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~TestColorControl_9_2() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: TestColorControl_9_2\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: TestColorControl_9_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH writes 0 to the Options attribute\n"); + err = TestThWrites0ToTheOptionsAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH sends On command to DUT\n"); + err = TestThSendsOnCommandToDut_2(); + break; + case 3: + ChipLogProgress(chipTool, + " ***** Test Step 3 : TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 (shortest " + "distance) and TransitionTime=0 (immediately).\n"); + err = TestThSendsEnhancedMoveToHueCommandToDutWithEnhancedHue0x4000Direction0x00ShortestDistanceAndTransitionTime0Immediately_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Wait for 100ms\n"); + err = TestWaitFor100ms_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0xF, Action attribute to 0x0 " + "(De-activate), Direction attribute to 0x0 (decrement hue), Time attribute to 30, and StartHue attribute to 0x00A0 " + "to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0xFActionAttributeTo0x0DeActivateDirectionAttributeTo0x0DecrementHueTimeAttributeTo30AndStartHueAttributeTo0x00A0ToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Read ColorLoopActive attribute from DUT\n"); + err = TestReadColorLoopActiveAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Read ColorLoopDirection attribute from DUT.\n"); + err = TestReadColorLoopDirectionAttributeFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read ColorLoopTime attribute from DUT.\n"); + err = TestReadColorLoopTimeAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read ColorLoopStartEnhancedHue attribute from DUT.\n"); + err = TestReadColorLoopStartEnhancedHueAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, + " ***** Test Step 10 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x1StartFromColorLoopStartEnhancedHueToDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Read ColorLoopActive attribute from DUT.\n"); + err = TestReadColorLoopActiveAttributeFromDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); + err = TestReadColorLoopStoredEnhancedHueAttributeFromDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Wait for 5S\n"); + err = TestWaitFor5s_13(); + break; + case 14: + ChipLogProgress(chipTool, + " ***** Test Step 14 : Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT.\n"); + err = TestSavingValueForComparisionReadColorLoopStartEnhancedHueAttributeFromDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Wait for 5S\n"); + err = TestWaitFor5s_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + "Direction attribute to 0x1 (increment hue) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x1IncrementHueToDut_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Read ColorLoopDirection attribute from DUT.\n"); + err = TestReadColorLoopDirectionAttributeFromDut_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Wait for 5S\n"); + err = TestWaitFor5s_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT.\n"); + err = TestSavingValueForComparisionReadColorLoopStartEnhancedHueAttributeFromDut_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 : Wait for 5S\n"); + err = TestWaitFor5s_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Read EnhancedCurrentHue attribute from DUT\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_24(); + break; + case 25: + ChipLogProgress(chipTool, + " ***** Test Step 25 : TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and Action " + "attribute to 0x0 (De-activate) to DUT.\n"); + err = TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_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 : Saving value for comparision read ColorLoopStoredEnhancedHue attribute from DUT.\n"); + err = TestSavingValueForComparisionReadColorLoopStoredEnhancedHueAttributeFromDut_27(); + break; + case 28: + ChipLogProgress(chipTool, " ***** Test Step 28 : Read EnhancedCurrentHue attribute from DUT.\n"); + err = TestReadEnhancedCurrentHueAttributeFromDut_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : Turn off light for color control tests\n"); + err = TestTurnOffLightForColorControlTests_29(); + break; + case 30: + ChipLogProgress(chipTool, " ***** Test Step 30 : Check on/off attribute value is false after off command\n"); + err = TestCheckOnOffAttributeValueIsFalseAfterOffCommand_30(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(400)); } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 31; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThWrites0ToTheOptionsAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id optionsArgument; + optionsArgument = [NSNumber numberWithUnsignedChar:0U]; + [cluster writeAttributeOptionsWithValue:optionsArgument + completion:^(NSError * _Nullable err) { + NSLog(@"TH writes 0 to the Options attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsOnCommandToDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster onWithCompletion:^(NSError * _Nullable err) { + NSLog(@"TH sends On command to DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsEnhancedMoveToHueCommandToDutWithEnhancedHue0x4000Direction0x00ShortestDistanceAndTransitionTime0Immediately_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterEnhancedMoveToHueParams alloc] init]; + params.enhancedHue = [NSNumber numberWithUnsignedShort:16384U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster enhancedMoveToHueWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends EnhancedMoveToHue command to DUT with EnhancedHue=0x4000, Direction=0x00 " + @"(shortest distance) and TransitionTime=0 (immediately). Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor100ms_4() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 100UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0xFActionAttributeTo0x0DeActivateDirectionAttributeTo0x0DecrementHueTimeAttributeTo30AndStartHueAttributeTo0x00A0ToDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:15U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:5U]; + params.startHue = [NSNumber numberWithUnsignedShort:160U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0xF, Action attribute to " + @"0x0 (De-activate), Direction attribute to 0x0 (decrement hue), Time attribute to 30, and " + @"StartHue attribute to 0x00A0 to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopDirection", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopTimeAttributeFromDut_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopTime attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopTime", actualValue, 5U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopStartEnhancedHueAttributeFromDut_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopStartEnhancedHue", actualValue, 160U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x1StartFromColorLoopStartEnhancedHueToDut_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:1U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x1 (start from ColorLoopStartEnhancedHue) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopStoredEnhancedHue", actualValue, 16384U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_13() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + NSNumber * _Nonnull ColorLoopStartEnhancedHueValue; + + CHIP_ERROR TestSavingValueForComparisionReadColorLoopStartEnhancedHueAttributeFromDut_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStartEnhancedHueValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueValue)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_16() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn(CheckConstraintMinValue( + "enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHueValue)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x2UpdateDirectionAndDirectionAttributeTo0x1IncrementHueToDut_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:2U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:1U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x2 (UpdateDirection) and " + @"Direction attribute to 0x1 (increment hue) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopDirectionAttributeFromDut_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopDirection attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopDirection", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_20() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + NSNumber * _Nonnull ColorLoopStartEnhancedHue; + + CHIP_ERROR TestSavingValueForComparisionReadColorLoopStartEnhancedHueAttributeFromDut_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparision read ColorLoopStartEnhancedHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStartEnhancedHue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn( + CheckConstraintMinValue("enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHue)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWaitFor5s_23() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForMs::Type value; + value.ms = 5000UL; + return WaitForMs("alpha", value); + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "int16u", "int16u")); + VerifyOrReturn( + CheckConstraintMinValue("enhancedCurrentHue", [value unsignedShortValue], ColorLoopStartEnhancedHue)); + VerifyOrReturn(CheckConstraintMaxValue("enhancedCurrentHue", [value unsignedShortValue], 65535U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSendsColorLoopSetCommandToWithUpdateFlagAttributeTo0x1UpdateActionAndActionAttributeTo0x0DeActivateToDut_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; + params.updateFlags = [NSNumber numberWithUnsignedChar:1U]; + params.action = [NSNumber numberWithUnsignedChar:0U]; + params.direction = [NSNumber numberWithUnsignedChar:0U]; + params.time = [NSNumber numberWithUnsignedShort:0U]; + params.startHue = [NSNumber numberWithUnsignedShort:0U]; + params.optionsMask = [NSNumber numberWithUnsignedChar:0U]; + params.optionsOverride = [NSNumber numberWithUnsignedChar:0U]; + [cluster colorLoopSetWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends ColorLoopSet command to with UpdateFlag attribute to 0x1 (UpdateAction) and " + @"Action attribute to 0x0 (De-activate) to DUT. Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read ColorLoopActive attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ColorLoopActive", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull ColorLoopStoredEnhancedHueValue; + + CHIP_ERROR TestSavingValueForComparisionReadColorLoopStoredEnhancedHueAttributeFromDut_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Saving value for comparision read ColorLoopStoredEnhancedHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + ColorLoopStoredEnhancedHueValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_28() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EnhancedCurrentHue", actualValue, ColorLoopStoredEnhancedHueValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestTurnOffLightForColorControlTests_29() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster offWithCompletion:^(NSError * _Nullable err) { + NSLog(@"Turn off light for color control tests Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestCheckOnOffAttributeValueIsFalseAfterOffCommand_30() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Check on/off attribute value is false after off command Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("OnOff", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_OPCREDS_1_2 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -133989,6 +137140,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),