diff --git a/examples/chip-tool/templates/tests.js b/examples/chip-tool/templates/tests.js index 69f03582b5564d..2a8a71863dfa33 100644 --- a/examples/chip-tool/templates/tests.js +++ b/examples/chip-tool/templates/tests.js @@ -91,9 +91,11 @@ function getTests() const LevelControl = [ 'Test_TC_LVL_1_1', 'Test_TC_LVL_2_1', + 'Test_TC_LVL_2_2', 'Test_TC_LVL_3_1', 'Test_TC_LVL_4_1', 'Test_TC_LVL_5_1', + 'Test_TC_LVL_6_1', ]; const MediaControl = [ @@ -110,6 +112,17 @@ function getTests() 'Test_TC_MC_3_9', 'Test_TC_MC_3_10', 'Test_TC_MC_3_11', + 'Test_TC_MC_5_1', + 'Test_TC_MC_5_2', + 'Test_TC_MC_5_3', + 'Test_TC_MC_6_1', + 'Test_TC_MC_6_2', + 'Test_TC_MC_6_3', + 'Test_TC_MC_6_4', + 'Test_TC_MC_7_1', + 'Test_TC_MC_7_2', + 'Test_TC_MC_8_1', + 'Test_TC_MC_9_1', ]; const OnOff = [ diff --git a/src/app/tests/suites/certification/Test_TC_LVL_2_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_2_1.yaml index 17b33244e8919c..cd5032e3dd6b6f 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_2_1.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Level Control [TC-LVL-2.1] MoveToLevel Verification with server as DUT +name: 24.2.1. [TC-LVL-2.1] Read cluster attributes (DUT as Server) config: cluster: "Level Control" @@ -23,116 +23,138 @@ tests: cluster: "DelayCommands" command: "WaitForCommissionee" - - label: "reads current Level attribute from DUT" + - label: "Reads the CurrentLevel attribute" command: "readAttribute" - attribute: "current Level" + attribute: "current level" response: value: 254 - - label: "sends a Move to level command" - command: "MoveToLevel" - arguments: - values: - - name: "level" - value: 64 - - name: "transitionTime" - value: 0 - - name: "optionMask" - value: 1 - - name: "optionOverride" - value: 1 - - - label: "Wait 100ms" - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 100 - - - label: "reads current Level attribute from DUT" - command: "readAttribute" - attribute: "current Level" - response: - value: 64 - - - label: "sends a Move to level command" - command: "MoveToLevel" - arguments: - values: - - name: "level" - value: 128 - - name: "transitionTime" - value: 1 - - name: "optionMask" - value: 1 - - name: "optionOverride" - value: 1 - - - label: "Wait 200ms" - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 200 + - label: "Reads the CurrentLevel attribute" + command: "readAttribute" + attribute: "current level" + response: + constraints: + type: uint8 - - label: "reads current Level attribute from DUT" + - label: "Reads the RemainingTime attribute" command: "readAttribute" - attribute: "current Level" + attribute: "remaining time" response: - value: 128 + value: 0 + constraints: + type: uint16 - - label: "reads On Off Transition Time attribute from DUT" + - label: "Reads the MinLevel attribute" command: "readAttribute" - attribute: "On Off Transition Time" + attribute: "min level" response: value: 0 + constraints: + type: uint8 - - label: "sends a Move to level command" - command: "MoveToLevel" - arguments: - values: - - name: "level" - value: 254 - - name: "transitionTime" - value: 65535 - - name: "optionMask" - value: 1 - - name: "optionOverride" - value: 1 - - - label: "Wait 10ms" - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 10 + - label: "Reads the MaxLevel attribute" + command: "readAttribute" + attribute: "max level" + response: + constraints: + type: uint8 - - label: "reads current Level attribute from DUT" + - label: "Reads the CurrentFrequency attribute" command: "readAttribute" - attribute: "current Level" + attribute: "current frequency" response: - value: 254 + value: 0 + constraints: + type: uint16 - - label: "Reset level to 254" - command: "MoveToLevel" - arguments: - values: - - name: "level" - value: 254 - - name: "transitionTime" - value: 0 - - name: "optionMask" - value: 1 - - name: "optionOverride" - value: 1 - - - label: "Wait 100ms" - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 100 + - label: "Reads the MinFrequency attribute" + command: "readAttribute" + attribute: "min frequency" + response: + value: 0 + constraints: + type: uint16 + + - label: "Reads the MaxFrequency attribute" + command: "readAttribute" + attribute: "max frequency" + response: + value: 0 + constraints: + type: uint16 + + - label: "Reads the OnOffTransitionTime attribute" + command: "readAttribute" + attribute: "on off transition time" + response: + value: 0 + constraints: + type: uint16 + + #Disabled due to issue - #13414 + - label: "Reads the OnLevel attribute " + disabled: true + command: "readAttribute" + attribute: "on level" + response: + value: null + + - label: "Reads the OnLevel attribute " + command: "readAttribute" + attribute: "on level" + response: + constraints: + type: uint8 + + #Disabled due to issue - #13414 + - label: "Reads the OnTransitionTime attribute " + disabled: true + command: "readAttribute" + attribute: "on transition time" + response: + value: null + + - label: "Reads the OnTransitionTime attribute " + command: "readAttribute" + attribute: "on transition time" + response: + constraints: + type: uint16 + + #Disabled due to issue - #13414 + - label: "Reads the OffTransitionTime attribute " + disabled: true + command: "readAttribute" + attribute: "off transition time" + response: + value: null + + - label: "Reads the OffTransitionTime attribute " + command: "readAttribute" + attribute: "off transition time" + response: + constraints: + type: uint16 + + - label: "Reads the DefaultMoveRate attribute " + command: "readAttribute" + attribute: "default move rate" + response: + constraints: + type: uint8 + + - label: "Reads the Options attribute " + command: "readAttribute" + attribute: "options" + response: + value: 0 + constraints: + type: map8 + + - label: "Reads the StartUpCurrentLevel attribute " + command: "readAttribute" + attribute: "start up current level" + response: + value: 0 + constraints: + type: uint8 diff --git a/src/app/tests/suites/certification/Test_TC_LVL_2_2.yaml b/src/app/tests/suites/certification/Test_TC_LVL_2_2.yaml new file mode 100644 index 00000000000000..d01d462b347020 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_LVL_2_2.yaml @@ -0,0 +1,168 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 24.2.2. [TC-LVL-2.2] Write cluster attributes (DUT as Server) + +config: + cluster: "Level Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "Reads the OnOffTransitionTime attribute from the DUT" + command: "readAttribute" + attribute: "on off transition time" + response: + value: 0 + constraints: + type: uint16 + + - label: "writes the OnOffTransitionTime attribute on the DUT" + command: "writeAttribute" + attribute: "on off transition time" + arguments: + value: 10 + + - label: "Reads the OnOffTransitionTime attribute from the DUT" + command: "readAttribute" + attribute: "on off transition time" + response: + value: 10 + constraints: + type: uint16 + + - label: "writes default value of OnOffTransitionTime attribute" + command: "writeAttribute" + attribute: "on off transition time" + arguments: + value: 0 + + #Disabled due to issue - #11670 + - label: "Reads the OnLevel attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "on level" + response: + value: null + constraints: + type: uint8 + + - label: "writes the OnLevel attribute on the DUT" + command: "writeAttribute" + attribute: "on level" + arguments: + value: 1 + + - label: "Reads the OnLevel attribute from the DUT" + command: "readAttribute" + attribute: "on level" + response: + value: 1 + constraints: + type: uint8 + + #Disabled due to issue - #11670 + - label: "Reads the OnTransitionTime attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "on transition time" + response: + value: null + constraints: + type: uint16 + + - label: "Writes the OnTransitionTime attribute on the DUT" + command: "writeAttribute" + attribute: "on transition time" + arguments: + value: 100 + + - label: "Reads the OnTransitionTime attribute from the DUT" + command: "readAttribute" + attribute: "on transition time" + response: + value: 100 + constraints: + type: uint16 + + #Disabled due to issue - #11670 + - label: "Reads the OffTransitionTime attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "off transition time" + response: + value: null + constraints: + type: uint16 + + - label: "Writes the OffTransitionTime attribute on the DUT" + command: "writeAttribute" + attribute: "off transition time" + arguments: + value: 100 + + - label: "Reads the OffTransitionTime attribute from the DUT" + command: "readAttribute" + attribute: "off transition time" + response: + value: 100 + constraints: + type: uint16 + + - label: "Reads the DefaultMoveRate attribute from the DUT" + command: "readAttribute" + attribute: "default move rate" + response: + value: 0 + constraints: + type: uint8 + + - label: "Writes the DefaultMoveRate attribute on the DUT" + command: "writeAttribute" + attribute: "default move rate" + arguments: + value: 100 + + - label: "Reads the DefaultMoveRate attribute from the DUT" + command: "readAttribute" + attribute: "default move rate" + response: + value: 100 + constraints: + type: uint8 + + - label: "Reads the StartUpCurrentLevel attribute from the DUT" + command: "readAttribute" + attribute: "start up current level" + response: + value: 0 + constraints: + type: uint8 + + - label: "writes the StartUpCurrentLevel attribute on the DUT" + command: "writeAttribute" + attribute: "start up current level" + arguments: + value: 1 + + - label: "reads the StartUpCurrentLevel attribute from the DUT" + command: "readAttribute" + attribute: "start up current level" + response: + value: 1 + constraints: + type: uint8 diff --git a/src/app/tests/suites/certification/Test_TC_LVL_3_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_3_1.yaml index 8db9e58750485a..05675a800ef748 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_3_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_3_1.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: Level Control [TC-LVL-3.1] Move Verification (DUT as Server) +name: 24.3.1. [TC-LVL-3.1] MoveToLevel Verification (DUT as Server) config: cluster: "Level Control" @@ -23,117 +23,110 @@ tests: cluster: "DelayCommands" command: "WaitForCommissionee" - - label: "reads current level attribute from DUT" + - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: value: 254 - - label: "reads max level attribute from DUT" + - label: "Reads the MinLevel attribute" + command: "readAttribute" + attribute: "min level" + response: + value: 0 + + - label: "Reads the MaxLevel attribute" command: "readAttribute" attribute: "max level" response: value: 255 - - label: "sends a Move up command" - command: "Move" + - label: "sends a Move to level command" + command: "MoveToLevel" arguments: values: - - name: "moveMode" + - name: "level" + value: 64 + - name: "transitionTime" value: 0 - - name: "rate" - value: 200 - name: "optionMask" value: 1 - name: "optionOverride" value: 1 - - label: "Wait 3000ms" + - label: "Wait 100ms" cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 3000 + value: 100 - - label: "reads current level attribute from DUT" + - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: - value: 255 - - - label: "reads min level attribute from DUT" - command: "readAttribute" - attribute: "min level" - response: - value: 0 + value: 64 - - label: "sends a Move down command" - command: "Move" + - label: "sends a Move to level command" + command: "MoveToLevel" arguments: values: - - name: "moveMode" + - name: "level" + value: 128 + - name: "transitionTime" value: 1 - - name: "rate" - value: 250 - name: "optionMask" value: 1 - name: "optionOverride" value: 1 - - label: "Wait 3000ms" + - label: "Wait 200ms" cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 3000 + value: 200 - - label: "reads current level attribute from DUT" + - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: - value: 0 - - - label: "Write default move rate attribute from DUT" - command: "writeAttribute" - attribute: "default move rate" - arguments: - value: 20 + value: 128 - - label: "reads default move rate attribute from DUT" + - label: "reads On Off Transition Time attribute from DUT" command: "readAttribute" - attribute: "default move rate" + attribute: "On Off Transition Time" response: - value: 20 + value: 0 - - label: "sends a Move up command at default move rate" - command: "Move" + - label: "sends a Move to level command" + command: "MoveToLevel" arguments: values: - - name: "moveMode" - value: 0 - - name: "rate" - value: 255 + - name: "level" + value: 254 + - name: "transitionTime" + value: 65535 - name: "optionMask" value: 1 - name: "optionOverride" value: 1 - - label: "Wait 100ms" + - label: "Wait 10ms" cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 100 + value: 10 - - label: "reads current level attribute from DUT" + - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: - constraints: - notValue: 255 + value: 254 - label: "Reset level to 254" command: "MoveToLevel" diff --git a/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml index 147ddcaf5dfb27..d21a5854b10858 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 24.4.1. [TC-LVL-4.1] Step Verification (DUT as Server) +name: 24.4.1. [TC-LVL-4.1] Move Verification (DUT as Server) config: cluster: "Level Control" @@ -23,24 +23,30 @@ tests: cluster: "DelayCommands" command: "WaitForCommissionee" - - label: "Sending on command" - cluster: "On/Off" - command: "on" + - label: "reads CurrentLevel attribute from DUT" + command: "readAttribute" + attribute: "current level" + response: + value: 254 + + - label: "reads max level attribute from DUT" + command: "readAttribute" + attribute: "max level" + response: + value: 255 - - label: "Precondition: DUT level is set to 0x80" - command: "Step" + - label: "sends a Move up command" + command: "Move" arguments: values: - - name: "stepMode" - value: 1 - - name: "stepSize" - value: 126 - - name: "transitionTime" - value: 20 - - name: "optionMask" + - name: "moveMode" value: 0 + - name: "rate" + value: 200 + - name: "optionMask" + value: 1 - name: "optionOverride" - value: 0 + value: 1 - label: "Wait 3000ms" cluster: "DelayCommands" @@ -50,26 +56,30 @@ tests: - name: "ms" value: 3000 - - label: "Reads current level attribute from DUT" + - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: - value: 128 + value: 255 + + - label: "reads min level attribute from DUT" + command: "readAttribute" + attribute: "min level" + response: + value: 0 - - label: "Sends step down command to DUT" - command: "Step" + - label: "sends a Move down command" + command: "Move" arguments: values: - - name: "stepMode" + - name: "moveMode" value: 1 - - name: "stepSize" - value: 64 - - name: "transitionTime" - value: 20 + - name: "rate" + value: 250 - name: "optionMask" - value: 0 + value: 1 - name: "optionOverride" - value: 0 + value: 1 - label: "Wait 3000ms" cluster: "DelayCommands" @@ -79,41 +89,69 @@ tests: - name: "ms" value: 3000 - - label: "Reads current level attribute from DUT" + - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: - value: 64 + value: 0 - - label: "Sends a Step up command" - command: "Step" + - label: "Write default move rate attribute from DUT" + command: "writeAttribute" + attribute: "default move rate" + arguments: + value: 20 + + - label: "reads default move rate attribute from DUT" + command: "readAttribute" + attribute: "default move rate" + response: + value: 20 + + - label: "sends a Move up command at default move rate" + command: "Move" arguments: values: - - name: "stepMode" + - name: "moveMode" value: 0 - - name: "stepSize" - value: 64 - - name: "transitionTime" - value: 20 + - name: "rate" + value: 255 - name: "optionMask" - value: 0 + value: 1 - name: "optionOverride" - value: 0 + value: 1 - - label: "Wait 3000ms" + - label: "Wait 100ms" cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 3000 + value: 100 - - label: "Reads current level attribute from DUT" + - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: - value: 128 + constraints: + notValue: 255 - - label: "Sending off command" - cluster: "On/Off" - command: "off" + - label: "Reset level to 254" + command: "MoveToLevel" + arguments: + values: + - name: "level" + value: 254 + - name: "transitionTime" + value: 0 + - name: "optionMask" + value: 1 + - name: "optionOverride" + value: 1 + + - label: "Wait 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 diff --git a/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml index 7e2cc8b2f28fd2..700e1eb671a925 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 24.5.1. [TC-LVL-5.1] Stop Verification (DUT as Server) +name: 24.5.1. [TC-LVL-5.1] Step Verification (DUT as Server) config: cluster: "Level Control" @@ -32,9 +32,9 @@ tests: arguments: values: - name: "stepMode" - value: 0 + value: 1 - name: "stepSize" - value: 128 + value: 126 - name: "transitionTime" value: 20 - name: "optionMask" @@ -50,26 +50,26 @@ tests: - name: "ms" value: 3000 - #Disabling as current level value read was returning null on darwin build. - label: "Reads current level attribute from DUT" - disabled: true command: "readAttribute" attribute: "current level" response: value: 128 - - label: "Sends a move up command to DUT" - command: "Move" + - label: "Sends step down command to DUT" + command: "Step" arguments: values: - - name: "moveMode" - value: 0 - - name: "rate" + - name: "stepMode" value: 1 + - name: "stepSize" + value: 64 + - name: "transitionTime" + value: 20 - name: "optionMask" - value: 1 + value: 0 - name: "optionOverride" - value: 1 + value: 0 - label: "Wait 3000ms" cluster: "DelayCommands" @@ -79,22 +79,61 @@ tests: - name: "ms" value: 3000 - - label: "Sends stop command to DUT" - command: "Stop" + - label: "Reads current level attribute from DUT" + command: "readAttribute" + attribute: "current level" + response: + value: 64 + + - label: "Sends a Step up command" + command: "Step" arguments: values: + - name: "stepMode" + value: 0 + - name: "stepSize" + value: 64 + - name: "transitionTime" + value: 20 - name: "optionMask" value: 0 - name: "optionOverride" value: 0 - #Disabling as current level value read was inconsistent when running test case multiple times. + - label: "Wait 3000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 3000 + - label: "Reads current level attribute from DUT" - disabled: true command: "readAttribute" attribute: "current level" response: - value: 133 + value: 128 + + - label: "Reset level to 254" + command: "MoveToLevel" + arguments: + values: + - name: "level" + value: 254 + - name: "transitionTime" + value: 0 + - name: "optionMask" + value: 1 + - name: "optionOverride" + value: 1 + + - label: "Wait 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 - label: "Sending off command" cluster: "On/Off" diff --git a/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml new file mode 100644 index 00000000000000..f95ec0767bb30f --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml @@ -0,0 +1,116 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 24.6.1. [TC-LVL-6.1] Stop Verification (DUT as Server) + +config: + cluster: "Level Control" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "Sending on command" + cluster: "On/Off" + command: "on" + + - label: "Precondition: set DUT to lowest point" + command: "MoveToLevel" + arguments: + values: + - name: "level" + value: 0 + - name: "transitionTime" + value: 0 + - name: "optionMask" + value: 1 + - name: "optionOverride" + value: 1 + + - label: "Wait 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Reads CurrentLevel attribute from DUT" + command: "readAttribute" + attribute: "current level" + response: + value: 0 + + - label: "Sends a move up command to DUT" + command: "Move" + arguments: + values: + - name: "moveMode" + value: 0 + - name: "rate" + value: 1 + - name: "optionMask" + value: 1 + - name: "optionOverride" + value: 1 + + - label: "Wait 2000ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 2000 + + - label: "Sends stop command to DUT" + command: "Stop" + arguments: + values: + - name: "optionMask" + value: 0 + - name: "optionOverride" + value: 0 + + - label: "Reads CurrentLevel attribute from DUT" + command: "readAttribute" + attribute: "current level" + response: + value: 2 + + - label: "Reset level to 254" + command: "MoveToLevel" + arguments: + values: + - name: "level" + value: 254 + - name: "transitionTime" + value: 0 + - name: "optionMask" + value: 1 + - name: "optionOverride" + value: 1 + + - label: "Wait 100ms" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + - label: "Sending off command" + cluster: "On/Off" + command: "off" diff --git a/src/app/tests/suites/certification/Test_TC_MC_5_1.yaml b/src/app/tests/suites/certification/Test_TC_MC_5_1.yaml new file mode 100644 index 00000000000000..b7c00c3d554c7b --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_5_1.yaml @@ -0,0 +1,55 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.7.1. [TC-MC-5.1] List TV Channels Verification + +config: + cluster: "Channel" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #issue 13412 TODO: Enable test and update response value when SDK supports. + - label: "Read attribute Channel list" + disabled: true + command: "readAttribute" + attribute: "Channel list" + response: + value: + [ + { + majorNumber: 1, + minorNumber: 2, + name: "exampleName", + callSign: "exampleCSign", + affiliateCallSign: "exampleASign", + }, + { + majorNumber: 2, + minorNumber: 3, + name: "exampleName", + callSign: "exampleCSign", + affiliateCallSign: "exampleASign", + }, + ] + + - label: "Reads the ChannelList attribute from the DUT" + command: "readAttribute" + attribute: "channel list" + response: + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_MC_5_2.yaml b/src/app/tests/suites/certification/Test_TC_MC_5_2.yaml new file mode 100644 index 00000000000000..24b01610fb63dc --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_5_2.yaml @@ -0,0 +1,61 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.7.2. [TC-MC-5.2] Change Channel by Number Verification + +config: + cluster: "Channel" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #Disabled due to issue- #13029 + - label: "Reads the ChannelList attribute" + disabled: true + command: "readAttribute" + attribute: "channel list" + response: + saveAs: ChanaelListValues + constraints: + type: list + + #Disabled due to issue- #13029 + - label: "TH sends a ChangeChannelByNumber command" + disabled: true + command: "ChangeChannelByNumber" + arguments: + values: + - name: "majorNumber" + value: ChanaelListValues + - name: "minorNumber" + value: ChanaelListValues + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "verify that the channel has changed on the device." + + #Disabled due to issue- #13029 + - label: "Reads the CurrentChannel attribute" + disabled: true + command: "readAttribute" + attribute: "current channel" + response: + value: ChanaelListValues diff --git a/src/app/tests/suites/certification/Test_TC_MC_5_3.yaml b/src/app/tests/suites/certification/Test_TC_MC_5_3.yaml new file mode 100644 index 00000000000000..77939dbdb99da9 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_5_3.yaml @@ -0,0 +1,67 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.7.3. [TC-MC-5.3] Skip Channel Verification + +config: + cluster: "Channel" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #Disabled due to issue- #13029 + - label: "Reads the ChannelList attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "channel list" + response: + saveAs: tvchannellistvalues + constraints: + type: list + + #Disabled due to issue- #13029 + - label: "Reads the CurrentChannel attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "current tv channel" + response: + value: channellistvalues + + #Disabled due to issue - #13084 + - label: "Sends a SkipChannel command to the DUT" + disabled: true + command: "SkipChannel" + arguments: + values: + - name: "Count" + value: 1 + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "verify that the channel has changed on the device" + + #Disabled due to issue- #13029 + - label: "Reads the CurrentChannel attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "current tv channel" + response: + value: channellistvalues diff --git a/src/app/tests/suites/certification/Test_TC_MC_6_1.yaml b/src/app/tests/suites/certification/Test_TC_MC_6_1.yaml new file mode 100644 index 00000000000000..b5c339a844a805 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_6_1.yaml @@ -0,0 +1,105 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.8.1. [TC-MC-6.1] Mandatory Media Playback Verification + +config: + cluster: "Media Playback" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #issue #12884 Media cluster commands and precondition not supported + - labe: "Precondition: Connect media content available for playback" + disabled: true + + - label: + "Precondition: Media content in a paused state at the beginning of the + content" + disabled: true + command: "MediaPause" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that media is paused" + + - label: "Reads the CurrentState attribute" + disabled: true + command: "readAttribute" + attribute: "playback state" + response: + value: 1 + + - label: "sends a Play command" + disabled: true + command: "MediaPlay" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Physically verify that the media is playing" + + - label: "Reads the playback state attribute" + command: "readAttribute" + attribute: "playback state" + response: + value: 0 + + - label: "sends a Pause command" + disabled: true + command: "MediaPause" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Physically verify that the media is paused" + + - label: "Reads the playback state attribute" + disabled: true + command: "readAttribute" + attribute: "playback state" + response: + value: 1 + + - label: "sends a Stop command" + disabled: true + command: "MediaStop" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Physically verify that the media is stoped" + + - label: "Reads the playback state attribute" + disabled: true + command: "readAttribute" + attribute: "playback state" + response: + value: 2 diff --git a/src/app/tests/suites/certification/Test_TC_MC_6_2.yaml b/src/app/tests/suites/certification/Test_TC_MC_6_2.yaml new file mode 100644 index 00000000000000..11ddbc6e0e9733 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_6_2.yaml @@ -0,0 +1,156 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.8.2. [TC-MC-6.2] Optional Media Playback Verification + +config: + cluster: "Media Playback" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #issue #12884 Media cluster commands and precondition not supported + - labe: "Precondition: Connect media content available for playback" + disabled: true + + - label: + "Precondition: Media content in a paused state at the beginning of the + content" + disabled: true + command: "MediaPause" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that media is paused" + + - label: "Precondition: At least 2 media items are queued" + disabled: true + + - label: "Reads the CurrentState attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "playback state" + response: + value: 1 + + - label: "Sends a Play command to the DUT" + disabled: true + command: "MediaPlay" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Physically verify that the media is playing" + + - label: "Reads the CurrentState attribute" + command: "readAttribute" + attribute: "playback state" + response: + value: 0 + + - label: "Sends a StartOver command to the DUT" + disabled: true + command: "MediaStartOver" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Physically verify that the media is started over" + + - label: "Sends a Next command to the DUT" + disabled: true + command: "MediaNext" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Verify that the next media item in the queue has been + loaded" + + - label: "Sends a Previous command to the DUT" + disabled: true + command: "MediaPrevious" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Verify that the previous media item in the queue has been + loaded" + + - label: "Sends a SkipForward command to the DUT " + disabled: true + command: "MediaSkipForward" + arguments: + values: + - name: "DeltaPositionMilliseconds" + value: 10000 + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that the media has skipped forward 10 seconds" + + - label: "Reads the SampledPosition attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "position" + response: + value: 10000 + + - label: "Sends a SkipBackward command to the DUT " + disabled: true + command: "MediaSkipBackward" + arguments: + values: + - name: "DeltaPositionMilliseconds" + value: 10000 + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that the media has skipped backward 10 seconds" + + - label: "Reads the SampledPosition attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "position" + response: + value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_MC_6_3.yaml b/src/app/tests/suites/certification/Test_TC_MC_6_3.yaml new file mode 100644 index 00000000000000..865086c176f875 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_6_3.yaml @@ -0,0 +1,98 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.8.3. [TC-MC-6.3] Advanced Seek Media Playback Verification + +config: + cluster: "Media Playback" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #issue #12884 Media cluster commands and precondition not supported + - labe: "Precondition: Connect media content available for playback" + disabled: true + + - label: + "Precondition: Media content in a paused state at the beginning of the + content" + disabled: true + command: "MediaPause" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that media is paused" + + - label: "Sends a Seek command" + disabled: true + command: "MediaSeek" + arguments: + values: + - name: "Position" + value: 10000 + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Verify that the media has moved to 10 seconds from the + starting point." + + - label: "Reads the SampledPosition attribute" + disabled: true + command: "readAttribute" + attribute: "position" + response: + value: 10000 + + #Issue #11475 User action needed + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "User prompt needed to enter the value beyond the furthest + valid position" + saveAs: positionValue + + # todo : Need a user input + - label: + "Sends a Seek command Position value beyond the furthest valid + position" + disabled: true + command: "MediaSeek" + arguments: + values: + - name: "position" + value: positionValue + + # response: SEEK_OUT_OF_RANGE + - label: "Reads the SampledPosition attribute" + disabled: true + command: "readAttribute" + attribute: "position" + response: + error: 5 diff --git a/src/app/tests/suites/certification/Test_TC_MC_6_4.yaml b/src/app/tests/suites/certification/Test_TC_MC_6_4.yaml new file mode 100644 index 00000000000000..829cdbc429f709 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_6_4.yaml @@ -0,0 +1,192 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.8.4. [TC-MC-6.4] Variable Speed Media Playback Verification + +config: + cluster: "Media Playback" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #issue #12884 Media cluster commands and precondition not supported + - labe: "Precondition: Connect media content available for playback" + disabled: true + + - label: + "Precondition: Media content in a paused state at the beginning of the + content" + disabled: true + command: "MediaPause" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that media is paused" + + - label: "Reads the CurrentState attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "playback state" + response: + value: 1 + + - label: "Reads the PlaybackSpeed attribute from the DUT" + command: "readAttribute" + attribute: "playback speed" + response: + value: 0 + + - label: "Sends a FastForward command" + disabled: true + command: "MediaFastForward" + response: + values: + - name: "returnValue" + - value: 0 + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that the media is playing" + + - label: "Reads the CurrentState attribute" + command: "readAttribute" + attribute: "playback state" + response: + value: 0 + + - label: "Reads the PlaybackSpeed attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "playback speed" + response: + value: 1 + + - label: "Sends a FastForward command" + disabled: true + command: "MediaFastForward" + response: + values: + - name: "returnValue" + - value: 0 + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that the media play speed has increased" + + - label: "Reads the PlaybackSpeed attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "playback speed" + response: + value: 2 + + - label: "Sends a Rewind command to the DUT" + disabled: true + command: "MediaRewind" + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that the media play has reversed direction" + + - label: "Reads the CurrentState attribute" + command: "readAttribute" + attribute: "playback state" + response: + value: 0 + + - label: "Reads the PlaybackSpeed attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "playback speed" + response: + value: -1 + + - label: "Sends a Rewind command to the DUT" + disabled: true + command: "MediaRewind" + response: + values: + - name: "returnValue" + - value: 0 + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Verify that the media play has reversed direction" + + - label: "Reads the PlaybackSpeed attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "playback speed" + response: + value: -2 + + - label: "Sends a Play command" + disabled: true + command: "MediaPlay" + response: + values: + - name: "returnValue" + - value: 0 + + - label: "log a command" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Verify that the media is has resumed playing forward at the + default speed" + + - label: "Reads the PlaybackSpeed attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "playback speed" + response: + value: 1 + + - label: "Sends consecutive FastForward commands" + disabled: true + command: "MediaFastForward" + response: + error: 4 + + - label: "Sends consecutive Rewind commands" + disabled: true + command: "MediaRewind" + response: + error: 4 diff --git a/src/app/tests/suites/certification/Test_TC_MC_7_1.yaml b/src/app/tests/suites/certification/Test_TC_MC_7_1.yaml new file mode 100644 index 00000000000000..b9030e69adaa29 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_7_1.yaml @@ -0,0 +1,53 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.9.1. [TC-MC-7.1] Select Output Verification + +config: + cluster: "Audio Output" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #Disabled due to issue- #13029 + - label: "Reads the OutputList attribute" + disabled: true + command: "readAttribute" + attribute: "audio output list" + response: + saveAs: outputListValues + constraints: + type: list + + #Disabled due to issue- #13029 + - label: "Sends a SelectAudioOutput command" + disabled: true + command: "SelectOutput" + arguments: + values: + - name: "Index" + value: outputListValues + + #Disabled due to issue- #13029 + - label: "Reads the CurrentOutput attribute" + disabled: true + command: "readAttribute" + attribute: "audio output list" + response: + value: outputListValues + constarints: + type: uint8 diff --git a/src/app/tests/suites/certification/Test_TC_MC_7_2.yaml b/src/app/tests/suites/certification/Test_TC_MC_7_2.yaml new file mode 100644 index 00000000000000..35c4f11b1c92c8 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_7_2.yaml @@ -0,0 +1,53 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.9.2. [TC-MC-7.2] Rename Output Verification + +config: + cluster: "Audio Output" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + #Disabled due to issue- #13029 + - label: "Reads the OutputList attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "audio output list" + response: + saveAs: audioOutputListValues + constraints: + type: list + + #Disabled due to issue- #13029 + - label: "Sends a RenameOutput command" + disabled: true + command: "RenameOutput" + arguments: + values: + - name: "Index" + value: audioOutputListValues + - name: "name" + value: "CertTest" + + #Disabled due to issue- #13029 + - label: "Reads the OutputList attribute from the DUT" + disabled: true + command: "readAttribute" + attribute: "audio output list" + response: + value: audioOutputListValues diff --git a/src/app/tests/suites/certification/Test_TC_MC_8_1.yaml b/src/app/tests/suites/certification/Test_TC_MC_8_1.yaml new file mode 100644 index 00000000000000..6a7588ce68da4a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_8_1.yaml @@ -0,0 +1,98 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 21.10.1. [TC-MC-8.1] Navigate Target Verification (DUT as Server) + +config: + cluster: "Target Navigator" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "Precondition: one or more navigation targets available" + disabled: true + + - label: "Reads the CurrentTarget attribute" + command: "readAttribute" + attribute: "current navigator target" + response: + saveAs: currentTarget + constraints: + type: uint8 + + - label: "Reads the TargetList attribute" + command: "readAttribute" + attribute: "target navigator list" + response: + constraints: + type: list + + #Below steps disabled due to issue- #13029 + #Disabled due to issue - #13087 + - label: "Reads the TargetList attribute" + disabled: true + command: "readAttribute" + attribute: "target navigator list" + response: + saveAs: TargetListValue + constraints: + type: list + + - label: "Sends a NavigateTarget command" + disabled: true + command: "NavigateTarget" + arguments: + values: + - name: "Target" + value: TargetListValue + saveAs: targetValue + - name: "Data" + value: TargetListvalue + + - label: "Reads the CurrentTarget attribute" + disabled: true + command: "readAttribute" + attribute: "current navigator target" + response: + value: targetValue + + - label: "Reads the TargetList attribute" + disabled: true + command: "readAttribute" + attribute: "target navigator list" + response: + saveAs: TargetListvalue + constraints: + type: list + + - label: "Sends a NavigateTarget command" + disabled: true + command: "NavigateTarget" + arguments: + values: + - name: "Target" + value: TargetListvalue + saveAs: targetvalue + - name: "Data" + value: TargetListvalue + + - label: "Reads the CurrentTarget attribute" + disabled: true + command: "readAttribute" + attribute: "current navigator target" + response: + value: targetvalue diff --git a/src/app/tests/suites/certification/Test_TC_MC_9_1.yaml b/src/app/tests/suites/certification/Test_TC_MC_9_1.yaml new file mode 100644 index 00000000000000..86aa868c6db96a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_MC_9_1.yaml @@ -0,0 +1,100 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: + 21.11.1. [TC-MC-9.1] Application Basic Attribute Verification (DUT as + Server) + +config: + cluster: "Application Basic" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + + - label: "Precondition" + cluster: "LogCommands" + command: "Log" + arguments: + values: + - name: "message" + value: "DUT has one or more Content Apps available" + + - label: "Reads the VendorName attribute" + command: "readAttribute" + attribute: "vendor name" + response: + constraints: + type: string + maxLenght: 32 + + - label: "Reads the VendorID attribute" + command: "readAttribute" + attribute: "vendor id" + response: + value: 0 + constraints: + type: vendor-id + saveAs: vendorID + + - label: "Reads the ApplicationName attribute" + command: "readAttribute" + attribute: "application name" + response: + constraints: + type: string + maxLength: 256 + + - label: "Reads the ProductID attribute" + command: "readAttribute" + attribute: "product id" + response: + constraints: + type: uint16 + + # TODO: Enable once attribute struct is supported + - label: "Reads the Application attribute" + disabled: true + command: "readAttribute" + attribute: "application app" + response: + value: { catalogVendorId: 123, applicationId: "applicationId" } + constraints: + type: struct + + - label: "Reads the Status attribute" + command: "readAttribute" + attribute: "application status" + response: + value: 0 + + - label: "Reads the ApplicationVersion attribute" + command: "readAttribute" + attribute: "application version" + response: + constraints: + type: string + maxLength: 32 + + #Disabled due to issue- #10882 + - label: "Reads the AllowedVendorList attribute" + disabled: true + command: "readAttribute" + attribute: "AllowedVendorList" + response: + value: [123, 987] + constraints: + type: list diff --git a/src/darwin/Framework/CHIP/templates/tests.js b/src/darwin/Framework/CHIP/templates/tests.js index e99a4d93413578..09c410c0bbfd22 100644 --- a/src/darwin/Framework/CHIP/templates/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests.js @@ -90,9 +90,11 @@ function getTests() const LevelControl = [ 'Test_TC_LVL_1_1', 'Test_TC_LVL_2_1', + 'Test_TC_LVL_2_2', 'Test_TC_LVL_3_1', 'Test_TC_LVL_4_1', 'Test_TC_LVL_5_1', + 'Test_TC_LVL_6_1', ]; const MediaControl = [ @@ -109,6 +111,17 @@ function getTests() 'Test_TC_MC_3_9', 'Test_TC_MC_3_10', 'Test_TC_MC_3_11', + 'Test_TC_MC_5_1', + 'Test_TC_MC_5_2', + 'Test_TC_MC_5_3', + 'Test_TC_MC_6_1', + 'Test_TC_MC_6_2', + 'Test_TC_MC_6_3', + 'Test_TC_MC_6_4', + 'Test_TC_MC_7_1', + 'Test_TC_MC_7_2', + 'Test_TC_MC_8_1', + 'Test_TC_MC_9_1', ]; const OnOff = [ diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 6c5e472199d19d..d99f9a8b777c87 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -10996,7 +10996,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000000_WaitForCommissionee } - (void)testSendClusterTest_TC_LVL_2_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentLevel attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -11004,7 +11004,7 @@ - (void)testSendClusterTest_TC_LVL_2_1_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + NSLog(@"Reads the CurrentLevel attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -11018,56 +11018,66 @@ - (void)testSendClusterTest_TC_LVL_2_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000002_MoveToLevel +- (void)testSendClusterTest_TC_LVL_2_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentLevel attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentLevel attribute Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000003_WaitForMs +- (void)testSendClusterTest_TC_LVL_2_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the RemainingTime attribute"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeRemainingTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the RemainingTime attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 0U); + } + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_LVL_2_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MinLevel attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MinLevel attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 64); + XCTAssertEqual([actualValue unsignedCharValue], 0); } [expectation fulfill]; @@ -11075,56 +11085,42 @@ - (void)testSendClusterTest_TC_LVL_2_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000005_MoveToLevel +- (void)testSendClusterTest_TC_LVL_2_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MaxLevel attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:128]; - params.transitionTime = [NSNumber numberWithUnsignedShort:1U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move to level command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MaxLevel attribute Error: %@", err); - [expectation fulfill]; - }]; + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000006_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 200ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 200); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentFrequency attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeCurrentFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentFrequency attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 128); + XCTAssertEqual([actualValue unsignedShortValue], 0U); } [expectation fulfill]; @@ -11132,17 +11128,17 @@ - (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000008_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads On Off Transition Time attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MinFrequency attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads On Off Transition Time attribute from DUT Error: %@", err); + [cluster readAttributeMinFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MinFrequency attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -11156,56 +11152,47 @@ - (void)testSendClusterTest_TC_LVL_2_1_000008_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000009_MoveToLevel +- (void)testSendClusterTest_TC_LVL_2_1_000008_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MaxFrequency attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:254]; - params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move to level command Error: %@", err); + [cluster readAttributeMaxFrequencyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MaxFrequency attribute Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 0U); + } - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000010_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 10ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 10); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000011_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current Level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnOffTransitionTime attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current Level attribute from DUT Error: %@", err); + [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnOffTransitionTime attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 254); + XCTAssertEqual([actualValue unsignedShortValue], 0U); } [expectation fulfill]; @@ -11213,146 +11200,99 @@ - (void)testSendClusterTest_TC_LVL_2_1_000011_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_2_1_000012_MoveToLevel +- (void)testSendClusterTest_TC_LVL_2_1_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnLevel attribute "]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:254]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Reset level to 254 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_2_1_000013_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + [cluster readAttributeOnLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnLevel attribute Error: %@", err); - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); -- (void)testSendClusterTest_TC_LVL_3_1_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnTransitionTime attribute "]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeOnTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnTransitionTime attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000012_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads max level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OffTransitionTime attribute "]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads max level attribute from DUT Error: %@", err); + [cluster readAttributeOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OffTransitionTime attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 255); - } - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000003_Move +- (void)testSendClusterTest_TC_LVL_2_1_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the DefaultMoveRate attribute "]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:200]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move up command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the DefaultMoveRate attribute Error: %@", err); - [expectation fulfill]; - }]; + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000004_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000014_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the Options attribute "]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeOptionsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the Options attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 255); + XCTAssertEqual([actualValue unsignedCharValue], 0); } [expectation fulfill]; @@ -11360,17 +11300,17 @@ - (void)testSendClusterTest_TC_LVL_3_1_000005_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_1_000015_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads min level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the StartUpCurrentLevel attribute "]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads min level attribute from DUT Error: %@", err); + [cluster readAttributeStartUpCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the StartUpCurrentLevel attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -11384,56 +11324,32 @@ - (void)testSendClusterTest_TC_LVL_3_1_000006_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000007_Move -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move down command"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedChar:250]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move down command Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000008_WaitForMs +- (void)testSendClusterTest_TC_LVL_2_2_000000_WaitForCommissionee { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); + WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_2_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnOffTransitionTime attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnOffTransitionTime attribute from the DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + XCTAssertEqual([actualValue unsignedShortValue], 0U); } [expectation fulfill]; @@ -11441,46 +11357,45 @@ - (void)testSendClusterTest_TC_LVL_3_1_000009_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000010_WriteAttribute +- (void)testSendClusterTest_TC_LVL_2_2_000002_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Write default move rate attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"writes the OnOffTransitionTime attribute on the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - id defaultMoveRateArgument; - defaultMoveRateArgument = [NSNumber numberWithUnsignedChar:20]; - [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write default move rate attribute from DUT Error: %@", err); + id onOffTransitionTimeArgument; + onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:10U]; + [cluster writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"writes the OnOffTransitionTime attribute on the DUT Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000011_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_2_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads default move rate attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnOffTransitionTime attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads default move rate attribute from DUT Error: %@", err); + [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnOffTransitionTime attribute from the DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 20); + XCTAssertEqual([actualValue unsignedShortValue], 10U); } [expectation fulfill]; @@ -11488,58 +11403,68 @@ - (void)testSendClusterTest_TC_LVL_3_1_000011_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000012_Move +- (void)testSendClusterTest_TC_LVL_2_2_000004_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command at default move rate"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"writes default value of OnOffTransitionTime attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:255]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"sends a Move up command at default move rate Error: %@", err); + id onOffTransitionTimeArgument; + onOffTransitionTimeArgument = [NSNumber numberWithUnsignedShort:0U]; + [cluster writeAttributeOnOffTransitionTimeWithValue:onOffTransitionTimeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"writes default value of OnOffTransitionTime attribute Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000013_WaitForMs +- (void)testSendClusterTest_TC_LVL_2_2_000005_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"writes the OnLevel attribute on the DUT"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id onLevelArgument; + onLevelArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster writeAttributeOnLevelWithValue:onLevelArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"writes the OnLevel attribute on the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000014_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_2_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnLevel attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads current level attribute from DUT Error: %@", err); + [cluster readAttributeOnLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnLevel attribute from the DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - if (actualValue != nil) { - XCTAssertNotEqual([actualValue unsignedCharValue], 255); - } + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 1); } [expectation fulfill]; @@ -11547,118 +11472,93 @@ - (void)testSendClusterTest_TC_LVL_3_1_000014_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_3_1_000015_MoveToLevel +- (void)testSendClusterTest_TC_LVL_2_2_000007_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Writes the OnTransitionTime attribute on the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:254]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; - [cluster moveToLevelWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Reset level to 254 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_3_1_000016_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + id onTransitionTimeArgument; + onTransitionTimeArgument = [NSNumber numberWithUnsignedShort:100U]; + [cluster writeAttributeOnTransitionTimeWithValue:onTransitionTimeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the OnTransitionTime attribute on the DUT Error: %@", err); - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); -- (void)testSendClusterTest_TC_LVL_4_1_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000001_On +- (void)testSendClusterTest_TC_LVL_2_2_000008_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OnTransitionTime attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending on command Error: %@", err); + [cluster readAttributeOnTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OnTransitionTime attribute from the DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedShortValue], 100U); + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000002_Step +- (void)testSendClusterTest_TC_LVL_2_2_000009_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Writes the OffTransitionTime attribute on the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedChar:126]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + id offTransitionTimeArgument; + offTransitionTimeArgument = [NSNumber numberWithUnsignedShort:100U]; + [cluster writeAttributeOffTransitionTimeWithValue:offTransitionTimeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the OffTransitionTime attribute on the DUT Error: %@", err); - [expectation fulfill]; - }]; + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000003_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_2_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the OffTransitionTime attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + [cluster readAttributeOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the OffTransitionTime attribute from the DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 128); + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedShortValue], 100U); } [expectation fulfill]; @@ -11666,57 +11566,71 @@ - (void)testSendClusterTest_TC_LVL_4_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000005_Step +- (void)testSendClusterTest_TC_LVL_2_2_000011_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step down command to DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the DefaultMoveRate attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends step down command to DUT Error: %@", err); + [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the DefaultMoveRate attribute from the DUT Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000006_WaitForMs +- (void)testSendClusterTest_TC_LVL_2_2_000012_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Writes the DefaultMoveRate attribute on the DUT"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id defaultMoveRateArgument; + defaultMoveRateArgument = [NSNumber numberWithUnsignedChar:100]; + [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes the DefaultMoveRate attribute on the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_2_000013_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the DefaultMoveRate attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); + [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the DefaultMoveRate attribute from the DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 64); + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 100); } [expectation fulfill]; @@ -11724,85 +11638,78 @@ - (void)testSendClusterTest_TC_LVL_4_1_000007_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000008_Step +- (void)testSendClusterTest_TC_LVL_2_2_000014_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step up command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the StartUpCurrentLevel attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:0]; - params.stepSize = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends a Step up command Error: %@", err); + [cluster readAttributeStartUpCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the StartUpCurrentLevel attribute from the DUT Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000009_WaitForMs -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + [expectation fulfill]; + }]; - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_LVL_2_2_000015_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"writes the StartUpCurrentLevel attribute on the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads current level attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + id startUpCurrentLevelArgument; + startUpCurrentLevelArgument = [NSNumber numberWithUnsignedChar:1]; + [cluster writeAttributeStartUpCurrentLevelWithValue:startUpCurrentLevelArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"writes the StartUpCurrentLevel attribute on the DUT Error: %@", err); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 128); - } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000011_Off +- (void)testSendClusterTest_TC_LVL_2_2_000016_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads the StartUpCurrentLevel attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending off command Error: %@", err); + [cluster readAttributeStartUpCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads the StartUpCurrentLevel attribute from the DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 1); + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_LVL_3_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -11810,233 +11717,1669 @@ - (void)testSendClusterTest_TC_LVL_5_1_000000_WaitForCommissionee WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000001_On +- (void)testSendClusterTest_TC_LVL_3_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending on command Error: %@", err); + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 254); + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000002_Step +- (void)testSendClusterTest_TC_LVL_3_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MinLevel attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:0]; - params.stepSize = [NSNumber numberWithUnsignedChar:128]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stepWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MinLevel attribute Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000003_WaitForMs +- (void)testSendClusterTest_TC_LVL_3_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the MaxLevel attribute"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the MaxLevel attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 255); + } + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000004_Move +- (void)testSendClusterTest_TC_LVL_3_1_000004_MoveToLevel { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a move up command to DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; - params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:1]; - params.optionMask = [NSNumber numberWithUnsignedChar:1]; - params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:64]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"sends a Move to level command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000005_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 64); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000007_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:128]; + params.transitionTime = [NSNumber numberWithUnsignedShort:1U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"sends a Move to level command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000008_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 200ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 200); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000009_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 128); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads On Off Transition Time attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOnOffTransitionTimeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads On Off Transition Time attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 0U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000011_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move to level command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"sends a Move to level command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000012_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 10ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 10); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 254); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000014_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_3_1_000015_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_4_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 254); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads max level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads max level attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 255); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000003_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0]; + params.rate = [NSNumber numberWithUnsignedChar:200]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"sends a Move up command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000004_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 255); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads min level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads min level attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000007_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move down command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:1]; + params.rate = [NSNumber numberWithUnsignedChar:250]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"sends a Move down command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000008_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000010_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Write default move rate attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id defaultMoveRateArgument; + defaultMoveRateArgument = [NSNumber numberWithUnsignedChar:20]; + [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Write default move rate attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000011_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads default move rate attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeDefaultMoveRateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads default move rate attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 20); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000012_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command at default move rate"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0]; + params.rate = [NSNumber numberWithUnsignedChar:255]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"sends a Move up command at default move rate Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000013_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000014_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertNotEqual([actualValue unsignedCharValue], 255); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000015_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000016_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_5_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000001_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Sending on command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000002_Step +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; + params.stepMode = [NSNumber numberWithUnsignedChar:1]; + params.stepSize = [NSNumber numberWithUnsignedChar:126]; + params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; + params.optionMask = [NSNumber numberWithUnsignedChar:0]; + params.optionOverride = [NSNumber numberWithUnsignedChar:0]; + [cluster stepWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000003_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 128); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000005_Step +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step down command to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; + params.stepMode = [NSNumber numberWithUnsignedChar:1]; + params.stepSize = [NSNumber numberWithUnsignedChar:64]; + params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; + params.optionMask = [NSNumber numberWithUnsignedChar:0]; + params.optionOverride = [NSNumber numberWithUnsignedChar:0]; + [cluster stepWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sends step down command to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000006_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000007_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 64); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000008_Step +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step up command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; + params.stepMode = [NSNumber numberWithUnsignedChar:0]; + params.stepSize = [NSNumber numberWithUnsignedChar:64]; + params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; + params.optionMask = [NSNumber numberWithUnsignedChar:0]; + params.optionOverride = [NSNumber numberWithUnsignedChar:0]; + [cluster stepWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sends a Step up command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000009_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000010_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads current level attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 128); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000011_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000012_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_5_1_000013_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Sending off command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_LVL_6_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000001_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending on command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Sending on command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000002_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: set DUT to lowest point"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:0]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Precondition: set DUT to lowest point Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000003_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000005_Move +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a move up command to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; + params.moveMode = [NSNumber numberWithUnsignedChar:0]; + params.rate = [NSNumber numberWithUnsignedChar:1]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveWithParams:params completionHandler:^(NSError * _Nullable err) { NSLog(@"Sends a move up command to DUT Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000006_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 2000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 2000); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000007_Stop +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends stop command to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterStopParams alloc] init]; + params.optionMask = [NSNumber numberWithUnsignedChar:0]; + params.optionOverride = [NSNumber numberWithUnsignedChar:0]; + [cluster stopWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Sends stop command to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentLevel attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads CurrentLevel attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 2); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000009_MoveToLevel +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; + params.level = [NSNumber numberWithUnsignedChar:254]; + params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.optionMask = [NSNumber numberWithUnsignedChar:1]; + params.optionOverride = [NSNumber numberWithUnsignedChar:1]; + [cluster moveToLevelWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Reset level to 254 Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000010_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 100); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_6_1_000011_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Sending off command Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_1_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_1_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestMediaInput * cluster = [[CHIPTestMediaInput alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_1_1_000002_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestMediaInput * cluster = [[CHIPTestMediaInput alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id clusterRevisionArgument; + clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; + [cluster + writeAttributeClusterRevisionWithValue:clusterRevisionArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_2_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_2_1_000001_Sleep +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Put the device into low power mode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster sleepWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Put the device into low power mode Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_2_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_3_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_4_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_5_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_6_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_7_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_8_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_9_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_10_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_3_11_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_5_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_5_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the ChannelList attribute from the DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestChannel * cluster = [[CHIPTestChannel alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeChannelListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the ChannelList attribute from the DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_5_2_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_5_2_000001_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"verify that the channel has changed on the device."); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_5_3_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_5_3_000001_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"verify that the channel has changed on the device"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_6_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_1_000001_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Verify that media is paused"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_1_000002_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Physically verify that the media is playing"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the playback state attribute"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributePlaybackStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the playback state attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_1_000004_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Physically verify that the media is paused"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_1_000005_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Physically verify that the media is stoped"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_MC_6_2_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_2_000001_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Verify that media is paused"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_2_000002_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Physically verify that the media is playing"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_2_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentState attribute"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributePlaybackStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentState attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_2_000004_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Physically verify that the media is started over"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_2_000005_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Verify that the next media item in the queue has been loaded"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_2_000006_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Verify that the previous media item in the queue has been loaded"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_2_000007_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - [expectation fulfill]; - }]; + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Verify that the media has skipped forward 10 seconds"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_2_000008_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Verify that the media has skipped backward 10 seconds"); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000005_WaitForMs + +- (void)testSendClusterTest_TC_MC_6_3_000000_WaitForCommissionee { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); + WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000006_Stop +- (void)testSendClusterTest_TC_MC_6_3_000001_UserPrompt { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends stop command to DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); + UserPrompt(expectation, queue, @"Verify that media is paused"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_3_000002_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - __auto_type * params = [[CHIPLevelControlClusterStopParams alloc] init]; - params.optionMask = [NSNumber numberWithUnsignedChar:0]; - params.optionOverride = [NSNumber numberWithUnsignedChar:0]; - [cluster stopWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends stop command to DUT Error: %@", err); + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Verify that the media has moved to 10 seconds from the starting point."); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_3_000003_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"User prompt needed to enter the value beyond the furthest valid position"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - [expectation fulfill]; - }]; +- (void)testSendClusterTest_TC_MC_6_4_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_6_4_000001_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, @"Verify that media is paused"); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_5_1_000007_Off +- (void)testSendClusterTest_TC_MC_6_4_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sending off command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the PlaybackSpeed attribute from the DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Sending off command Error: %@", err); + [cluster readAttributePlaybackSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the PlaybackSpeed attribute from the DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue floatValue], 0.0f); + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_MC_1_1_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_MC_6_4_000003_UserPrompt { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); + UserPrompt(expectation, queue, @"Verify that the media is playing"); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_MC_1_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_MC_6_4_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentState attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestMediaInput * cluster = [[CHIPTestMediaInput alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributePlaybackStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentState attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_MC_1_1_000002_WriteAttribute +- (void)testSendClusterTest_TC_MC_6_4_000005_UserPrompt { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; - CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestMediaInput * cluster = [[CHIPTestMediaInput alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - + UserPrompt(expectation, queue, @"Verify that the media play speed has increased"); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_MC_2_1_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_MC_6_4_000006_UserPrompt { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); + UserPrompt(expectation, queue, @"Verify that the media play has reversed direction"); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_MC_2_1_000001_Sleep +- (void)testSendClusterTest_TC_MC_6_4_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Put the device into low power mode"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentState attribute"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLowPower * cluster = [[CHIPTestLowPower alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestMediaPlayback * cluster = [[CHIPTestMediaPlayback alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster sleepWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Put the device into low power mode Error: %@", err); + [cluster readAttributePlaybackStateWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentState attribute Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_MC_3_1_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_MC_6_4_000008_UserPrompt { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); + UserPrompt(expectation, queue, @"Verify that the media play has reversed direction"); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_MC_3_2_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_MC_6_4_000009_UserPrompt { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"log a command"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); + UserPrompt(expectation, queue, @"Verify that the media is has resumed playing forward at the default speed"); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_MC_3_3_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_MC_7_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -12045,7 +13388,7 @@ - (void)testSendClusterTest_TC_MC_3_3_000000_WaitForCommissionee [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_MC_3_4_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_MC_7_2_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -12054,7 +13397,7 @@ - (void)testSendClusterTest_TC_MC_3_4_000000_WaitForCommissionee [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_MC_3_5_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_MC_8_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -12062,17 +13405,47 @@ - (void)testSendClusterTest_TC_MC_3_5_000000_WaitForCommissionee WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +uint8_t currentTarget; +- (void)testSendClusterTest_TC_MC_8_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the CurrentTarget attribute"]; -- (void)testSendClusterTest_TC_MC_3_6_000000_WaitForCommissionee + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentNavigatorTargetWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the CurrentTarget attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_8_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the TargetList attribute"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); + CHIPTestTargetNavigator * cluster = [[CHIPTestTargetNavigator alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeTargetNavigatorListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the TargetList attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_MC_3_7_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_MC_9_1_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; @@ -12080,40 +13453,146 @@ - (void)testSendClusterTest_TC_MC_3_7_000000_WaitForCommissionee WaitForCommissionee(expectation, queue); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_MC_3_8_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_MC_9_1_000001_Log { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); + Log(expectation, queue, @"DUT has one or more Content Apps available"); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_MC_9_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the VendorName attribute"]; -- (void)testSendClusterTest_TC_MC_3_9_000000_WaitForCommissionee + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeVendorNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the VendorName attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_9_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the VendorID attribute"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeVendorIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the VendorID attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedShortValue], 0U); + } + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_MC_9_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the ApplicationName attribute"]; -- (void)testSendClusterTest_TC_MC_3_10_000000_WaitForCommissionee + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeApplicationNameWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the ApplicationName attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertLessThanOrEqual([actualValue length], 256); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_9_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the ProductID attribute"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeProductIdWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the ProductID attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_MC_9_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the Status attribute"]; -- (void)testSendClusterTest_TC_MC_3_11_000000_WaitForCommissionee + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeApplicationStatusWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the Status attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_MC_9_1_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the ApplicationVersion attribute"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue); + CHIPTestApplicationBasic * cluster = [[CHIPTestApplicationBasic alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeApplicationVersionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads the ApplicationVersion attribute Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertLessThanOrEqual([actualValue length], 32); + } + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index ee9f04e9bf6dd5..3e9075940d9a02 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -75,9 +75,11 @@ class TestList : public Command printf("Test_TC_ILL_1_1\n"); printf("Test_TC_LVL_1_1\n"); printf("Test_TC_LVL_2_1\n"); + printf("Test_TC_LVL_2_2\n"); printf("Test_TC_LVL_3_1\n"); printf("Test_TC_LVL_4_1\n"); printf("Test_TC_LVL_5_1\n"); + printf("Test_TC_LVL_6_1\n"); printf("Test_TC_MC_1_1\n"); printf("Test_TC_MC_2_1\n"); printf("Test_TC_MC_3_1\n"); @@ -91,6 +93,17 @@ class TestList : public Command printf("Test_TC_MC_3_9\n"); printf("Test_TC_MC_3_10\n"); printf("Test_TC_MC_3_11\n"); + printf("Test_TC_MC_5_1\n"); + printf("Test_TC_MC_5_2\n"); + printf("Test_TC_MC_5_3\n"); + printf("Test_TC_MC_6_1\n"); + printf("Test_TC_MC_6_2\n"); + printf("Test_TC_MC_6_3\n"); + printf("Test_TC_MC_6_4\n"); + printf("Test_TC_MC_7_1\n"); + printf("Test_TC_MC_7_2\n"); + printf("Test_TC_MC_8_1\n"); + printf("Test_TC_MC_9_1\n"); printf("Test_TC_OCC_1_1\n"); printf("Test_TC_OCC_2_1\n"); printf("Test_TC_OCC_2_2\n"); @@ -17396,56 +17409,64 @@ class Test_TC_LVL_2_1 : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the CurrentLevel attribute\n"); + err = TestReadsTheCurrentLevelAttribute_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the CurrentLevel attribute\n"); + err = TestReadsTheCurrentLevelAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 100ms\n"); - err = TestWait100ms_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the RemainingTime attribute\n"); + err = TestReadsTheRemainingTimeAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the MinLevel attribute\n"); + err = TestReadsTheMinLevelAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the MaxLevel attribute\n"); + err = TestReadsTheMaxLevelAttribute_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 200ms\n"); - err = TestWait200ms_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the CurrentFrequency attribute\n"); + err = TestReadsTheCurrentFrequencyAttribute_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the MinFrequency attribute\n"); + err = TestReadsTheMinFrequencyAttribute_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : reads On Off Transition Time attribute from DUT\n"); - err = TestReadsOnOffTransitionTimeAttributeFromDut_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the MaxFrequency attribute\n"); + err = TestReadsTheMaxFrequencyAttribute_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : sends a Move to level command\n"); - err = TestSendsAMoveToLevelCommand_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Reads the OnOffTransitionTime attribute\n"); + err = TestReadsTheOnOffTransitionTimeAttribute_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 10ms\n"); - err = TestWait10ms_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OnLevel attribute \n"); + err = TestReadsTheOnLevelAttribute_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : reads current Level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the OnTransitionTime attribute \n"); + err = TestReadsTheOnTransitionTimeAttribute_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Reset level to 254\n"); - err = TestResetLevelTo254_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Reads the OffTransitionTime attribute \n"); + err = TestReadsTheOffTransitionTimeAttribute_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Wait 100ms\n"); - err = TestWait100ms_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the DefaultMoveRate attribute \n"); + err = TestReadsTheDefaultMoveRateAttribute_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Reads the Options attribute \n"); + err = TestReadsTheOptionsAttribute_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads the StartUpCurrentLevel attribute \n"); + err = TestReadsTheStartUpCurrentLevelAttribute_15(); break; } @@ -17458,7 +17479,7 @@ class Test_TC_LVL_2_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 14; + const uint16_t mTestCount = 16; chip::Optional mCluster; chip::Optional mEndpoint; @@ -17473,14 +17494,54 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnSuccessResponse_1(currentLevel); } + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_2(currentLevel); + } + + static void OnFailureCallback_3(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint16_t remainingTime) + { + (static_cast(context))->OnSuccessResponse_3(remainingTime); + } + static void OnFailureCallback_4(void * context, EmberAfStatus status) { (static_cast(context))->OnFailureResponse_4(status); } - static void OnSuccessCallback_4(void * context, uint8_t currentLevel) + static void OnSuccessCallback_4(void * context, uint8_t minLevel) + { + (static_cast(context))->OnSuccessResponse_4(minLevel); + } + + static void OnFailureCallback_5(void * context, EmberAfStatus status) { - (static_cast(context))->OnSuccessResponse_4(currentLevel); + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint8_t maxLevel) + { + (static_cast(context))->OnSuccessResponse_5(maxLevel); + } + + static void OnFailureCallback_6(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint16_t currentFrequency) + { + (static_cast(context))->OnSuccessResponse_6(currentFrequency); } static void OnFailureCallback_7(void * context, EmberAfStatus status) @@ -17488,9 +17549,9 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_7(status); } - static void OnSuccessCallback_7(void * context, uint8_t currentLevel) + static void OnSuccessCallback_7(void * context, uint16_t minFrequency) { - (static_cast(context))->OnSuccessResponse_7(currentLevel); + (static_cast(context))->OnSuccessResponse_7(minFrequency); } static void OnFailureCallback_8(void * context, EmberAfStatus status) @@ -17498,9 +17559,29 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_8(status); } - static void OnSuccessCallback_8(void * context, uint16_t onOffTransitionTime) + static void OnSuccessCallback_8(void * context, uint16_t maxFrequency) + { + (static_cast(context))->OnSuccessResponse_8(maxFrequency); + } + + static void OnFailureCallback_9(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, uint16_t onOffTransitionTime) + { + (static_cast(context))->OnSuccessResponse_9(onOffTransitionTime); + } + + static void OnFailureCallback_10(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context, const chip::app::DataModel::Nullable & onLevel) { - (static_cast(context))->OnSuccessResponse_8(onOffTransitionTime); + (static_cast(context))->OnSuccessResponse_10(onLevel); } static void OnFailureCallback_11(void * context, EmberAfStatus status) @@ -17508,9 +17589,49 @@ class Test_TC_LVL_2_1 : public TestCommand (static_cast(context))->OnFailureResponse_11(status); } - static void OnSuccessCallback_11(void * context, uint8_t currentLevel) + static void OnSuccessCallback_11(void * context, const chip::app::DataModel::Nullable & onTransitionTime) + { + (static_cast(context))->OnSuccessResponse_11(onTransitionTime); + } + + static void OnFailureCallback_12(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_12(status); + } + + static void OnSuccessCallback_12(void * context, const chip::app::DataModel::Nullable & offTransitionTime) { - (static_cast(context))->OnSuccessResponse_11(currentLevel); + (static_cast(context))->OnSuccessResponse_12(offTransitionTime); + } + + static void OnFailureCallback_13(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_13(status); + } + + static void OnSuccessCallback_13(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) + { + (static_cast(context))->OnSuccessResponse_13(defaultMoveRate); + } + + static void OnFailureCallback_14(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_14(status); + } + + static void OnSuccessCallback_14(void * context, uint8_t options) + { + (static_cast(context))->OnSuccessResponse_14(options); + } + + static void OnFailureCallback_15(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_15(status); + } + + static void OnSuccessCallback_15(void * context, uint8_t startUpCurrentLevel) + { + (static_cast(context))->OnSuccessResponse_15(startUpCurrentLevel); } // @@ -17523,7 +17644,7 @@ class Test_TC_LVL_2_1 : public TestCommand return WaitForCommissionee(); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_1() + CHIP_ERROR TestReadsTheCurrentLevelAttribute_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; @@ -17543,223 +17664,285 @@ class Test_TC_LVL_2_1 : public TestCommand NextTest(); } - CHIP_ERROR TestSendsAMoveToLevelCommand_2() + CHIP_ERROR TestReadsTheCurrentLevelAttribute_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - RequestType request; - request.level = 64; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); - }; + void OnSuccessResponse_2(uint8_t currentLevel) + { + VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); + NextTest(); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + CHIP_ERROR TestReadsTheRemainingTimeAttribute_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); return CHIP_NO_ERROR; } - void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } - - void OnSuccessResponse_2() { NextTest(); } + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } - CHIP_ERROR TestWait100ms_3() + void OnSuccessResponse_3(uint16_t remainingTime) { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); + VerifyOrReturn(CheckValue("remainingTime", remainingTime, 0U)); + + NextTest(); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + CHIP_ERROR TestReadsTheMinLevelAttribute_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_4, OnFailureCallback_4)); return CHIP_NO_ERROR; } void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint8_t currentLevel) + void OnSuccessResponse_4(uint8_t minLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); NextTest(); } - CHIP_ERROR TestSendsAMoveToLevelCommand_5() + CHIP_ERROR TestReadsTheMaxLevelAttribute_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - RequestType request; - request.level = 128; - request.transitionTime = 1U; - request.optionMask = 1; - request.optionOverride = 1; + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5)); + return CHIP_NO_ERROR; + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); - }; + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_5(status); - }; + void OnSuccessResponse_5(uint8_t maxLevel) + { + VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); + NextTest(); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + CHIP_ERROR TestReadsTheCurrentFrequencyAttribute_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6)); return CHIP_NO_ERROR; } - void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } - - void OnSuccessResponse_5() { NextTest(); } + void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } - CHIP_ERROR TestWait200ms_6() + void OnSuccessResponse_6(uint16_t currentFrequency) { - SetIdentity(kIdentityAlpha); - return WaitForMs(200); + VerifyOrReturn(CheckValue("currentFrequency", currentFrequency, 0U)); + + NextTest(); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_7() + CHIP_ERROR TestReadsTheMinFrequencyAttribute_7() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_7, OnFailureCallback_7)); return CHIP_NO_ERROR; } void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(uint8_t currentLevel) + void OnSuccessResponse_7(uint16_t minFrequency) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + VerifyOrReturn(CheckValue("minFrequency", minFrequency, 0U)); NextTest(); } - CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_8() + CHIP_ERROR TestReadsTheMaxFrequencyAttribute_8() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_8, OnFailureCallback_8)); return CHIP_NO_ERROR; } void OnFailureResponse_8(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_8(uint16_t onOffTransitionTime) + void OnSuccessResponse_8(uint16_t maxFrequency) { - VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); + VerifyOrReturn(CheckValue("maxFrequency", maxFrequency, 0U)); NextTest(); } - CHIP_ERROR TestSendsAMoveToLevelCommand_9() + CHIP_ERROR TestReadsTheOnOffTransitionTimeAttribute_9() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - RequestType request; - request.level = 254; - request.transitionTime = 65535U; - request.optionMask = 1; - request.optionOverride = 1; + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_9, OnFailureCallback_9)); + return CHIP_NO_ERROR; + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_9(); - }; + void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_9(status); - }; + void OnSuccessResponse_9(uint16_t onOffTransitionTime) + { + VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + NextTest(); } - void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } + CHIP_ERROR TestReadsTheOnLevelAttribute_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - void OnSuccessResponse_9() { NextTest(); } + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(EmberAfStatus status) { ThrowFailureResponse(); } - CHIP_ERROR TestWait10ms_10() + void OnSuccessResponse_10(const chip::app::DataModel::Nullable & onLevel) { - SetIdentity(kIdentityAlpha); - return WaitForMs(10); + VerifyOrReturn(CheckConstraintType("onLevel", "", "uint8")); + NextTest(); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_11() + CHIP_ERROR TestReadsTheOnTransitionTimeAttribute_11() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_11, OnFailureCallback_11)); return CHIP_NO_ERROR; } void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_11(uint8_t currentLevel) + void OnSuccessResponse_11(const chip::app::DataModel::Nullable & onTransitionTime) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + VerifyOrReturn(CheckConstraintType("onTransitionTime", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadsTheOffTransitionTimeAttribute_12() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(EmberAfStatus status) { ThrowFailureResponse(); } + void OnSuccessResponse_12(const chip::app::DataModel::Nullable & offTransitionTime) + { + VerifyOrReturn(CheckConstraintType("offTransitionTime", "", "uint16")); NextTest(); } - CHIP_ERROR TestResetLevelTo254_12() + CHIP_ERROR TestReadsTheDefaultMoveRateAttribute_13() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - RequestType request; - request.level = 254; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_13, OnFailureCallback_13)); + return CHIP_NO_ERROR; + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; + void OnFailureResponse_13(EmberAfStatus status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_12(status); - }; + void OnSuccessResponse_13(const chip::app::DataModel::Nullable & defaultMoveRate) + { + VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); + NextTest(); + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + CHIP_ERROR TestReadsTheOptionsAttribute_14() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_14, OnFailureCallback_14)); return CHIP_NO_ERROR; } - void OnFailureResponse_12(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_14(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_12() { NextTest(); } + void OnSuccessResponse_14(uint8_t options) + { + VerifyOrReturn(CheckValue("options", options, 0)); - CHIP_ERROR TestWait100ms_13() + NextTest(); + } + + CHIP_ERROR TestReadsTheStartUpCurrentLevelAttribute_15() { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_15, OnFailureCallback_15)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_15(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_15(uint8_t startUpCurrentLevel) + { + VerifyOrReturn(CheckValue("startUpCurrentLevel", startUpCurrentLevel, 0)); + + NextTest(); } }; -class Test_TC_LVL_3_1 : public TestCommand +class Test_TC_LVL_2_2 : public TestCommand { public: - Test_TC_LVL_3_1() : TestCommand("Test_TC_LVL_3_1"), mTestIndex(0) + Test_TC_LVL_2_2() : TestCommand("Test_TC_LVL_2_2"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -17772,12 +17955,12 @@ class Test_TC_LVL_3_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_3_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_2_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_2_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -17795,68 +17978,68 @@ class Test_TC_LVL_3_1 : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the OnOffTransitionTime attribute from the DUT\n"); + err = TestReadsTheOnOffTransitionTimeAttributeFromTheDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : reads max level attribute from DUT\n"); - err = TestReadsMaxLevelAttributeFromDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : writes the OnOffTransitionTime attribute on the DUT\n"); + err = TestWritesTheOnOffTransitionTimeAttributeOnTheDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : sends a Move up command\n"); - err = TestSendsAMoveUpCommand_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the OnOffTransitionTime attribute from the DUT\n"); + err = TestReadsTheOnOffTransitionTimeAttributeFromTheDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); - err = TestWait3000ms_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : writes default value of OnOffTransitionTime attribute\n"); + err = TestWritesDefaultValueOfOnOffTransitionTimeAttribute_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : writes the OnLevel attribute on the DUT\n"); + err = TestWritesTheOnLevelAttributeOnTheDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : reads min level attribute from DUT\n"); - err = TestReadsMinLevelAttributeFromDut_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the OnLevel attribute from the DUT\n"); + err = TestReadsTheOnLevelAttributeFromTheDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : sends a Move down command\n"); - err = TestSendsAMoveDownCommand_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Writes the OnTransitionTime attribute on the DUT\n"); + err = TestWritesTheOnTransitionTimeAttributeOnTheDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 3000ms\n"); - err = TestWait3000ms_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads the OnTransitionTime attribute from the DUT\n"); + err = TestReadsTheOnTransitionTimeAttributeFromTheDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Writes the OffTransitionTime attribute on the DUT\n"); + err = TestWritesTheOffTransitionTimeAttributeOnTheDut_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Write default move rate attribute from DUT\n"); - err = TestWriteDefaultMoveRateAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads the OffTransitionTime attribute from the DUT\n"); + err = TestReadsTheOffTransitionTimeAttributeFromTheDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : reads default move rate attribute from DUT\n"); - err = TestReadsDefaultMoveRateAttributeFromDut_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Reads the DefaultMoveRate attribute from the DUT\n"); + err = TestReadsTheDefaultMoveRateAttributeFromTheDut_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : sends a Move up command at default move rate\n"); - err = TestSendsAMoveUpCommandAtDefaultMoveRate_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Writes the DefaultMoveRate attribute on the DUT\n"); + err = TestWritesTheDefaultMoveRateAttributeOnTheDut_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Wait 100ms\n"); - err = TestWait100ms_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads the DefaultMoveRate attribute from the DUT\n"); + err = TestReadsTheDefaultMoveRateAttributeFromTheDut_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_14(); + ChipLogProgress(chipTool, " ***** Test Step 14 : Reads the StartUpCurrentLevel attribute from the DUT\n"); + err = TestReadsTheStartUpCurrentLevelAttributeFromTheDut_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Reset level to 254\n"); - err = TestResetLevelTo254_15(); + ChipLogProgress(chipTool, " ***** Test Step 15 : writes the StartUpCurrentLevel attribute on the DUT\n"); + err = TestWritesTheStartUpCurrentLevelAttributeOnTheDut_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Wait 100ms\n"); - err = TestWait100ms_16(); + ChipLogProgress(chipTool, " ***** Test Step 16 : reads the StartUpCurrentLevel attribute from the DUT\n"); + err = TestReadsTheStartUpCurrentLevelAttributeFromTheDut_16(); break; } @@ -17876,79 +18059,141 @@ class Test_TC_LVL_3_1 : public TestCommand static void OnFailureCallback_1(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); + (static_cast(context))->OnFailureResponse_1(status); } - static void OnSuccessCallback_1(void * context, uint8_t currentLevel) + static void OnSuccessCallback_1(void * context, uint16_t onOffTransitionTime) { - (static_cast(context))->OnSuccessResponse_1(currentLevel); + (static_cast(context))->OnSuccessResponse_1(onOffTransitionTime); } static void OnFailureCallback_2(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_2(status); } - static void OnSuccessCallback_2(void * context, uint8_t maxLevel) + static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } + + static void OnFailureCallback_3(void * context, EmberAfStatus status) { - (static_cast(context))->OnSuccessResponse_2(maxLevel); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnFailureCallback_5(void * context, EmberAfStatus status) + static void OnSuccessCallback_3(void * context, uint16_t onOffTransitionTime) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnSuccessResponse_3(onOffTransitionTime); } - static void OnSuccessCallback_5(void * context, uint8_t currentLevel) + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } + + static void OnFailureCallback_5(void * context, EmberAfStatus status) { - (static_cast(context))->OnSuccessResponse_5(currentLevel); + (static_cast(context))->OnFailureResponse_5(status); } + static void OnSuccessCallback_5(void * context) { (static_cast(context))->OnSuccessResponse_5(); } + static void OnFailureCallback_6(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); + (static_cast(context))->OnFailureResponse_6(status); } - static void OnSuccessCallback_6(void * context, uint8_t minLevel) + static void OnSuccessCallback_6(void * context, const chip::app::DataModel::Nullable & onLevel) { - (static_cast(context))->OnSuccessResponse_6(minLevel); + (static_cast(context))->OnSuccessResponse_6(onLevel); } - static void OnFailureCallback_9(void * context, EmberAfStatus status) + static void OnFailureCallback_7(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_9(status); + (static_cast(context))->OnFailureResponse_7(status); } - static void OnSuccessCallback_9(void * context, uint8_t currentLevel) + static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } + + static void OnFailureCallback_8(void * context, EmberAfStatus status) { - (static_cast(context))->OnSuccessResponse_9(currentLevel); + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, const chip::app::DataModel::Nullable & onTransitionTime) + { + (static_cast(context))->OnSuccessResponse_8(onTransitionTime); + } + + static void OnFailureCallback_9(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_9(status); } + static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } + static void OnFailureCallback_10(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } + static void OnSuccessCallback_10(void * context, const chip::app::DataModel::Nullable & offTransitionTime) + { + (static_cast(context))->OnSuccessResponse_10(offTransitionTime); + } static void OnFailureCallback_11(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); + (static_cast(context))->OnFailureResponse_11(status); } static void OnSuccessCallback_11(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) { - (static_cast(context))->OnSuccessResponse_11(defaultMoveRate); + (static_cast(context))->OnSuccessResponse_11(defaultMoveRate); + } + + static void OnFailureCallback_12(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_12(status); + } + + static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } + + static void OnFailureCallback_13(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_13(status); + } + + static void OnSuccessCallback_13(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) + { + (static_cast(context))->OnSuccessResponse_13(defaultMoveRate); } static void OnFailureCallback_14(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_14(status); + (static_cast(context))->OnFailureResponse_14(status); } - static void OnSuccessCallback_14(void * context, uint8_t currentLevel) + static void OnSuccessCallback_14(void * context, uint8_t startUpCurrentLevel) + { + (static_cast(context))->OnSuccessResponse_14(startUpCurrentLevel); + } + + static void OnFailureCallback_15(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_15(status); + } + + static void OnSuccessCallback_15(void * context) { (static_cast(context))->OnSuccessResponse_15(); } + + static void OnFailureCallback_16(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_16(status); + } + + static void OnSuccessCallback_16(void * context, uint8_t startUpCurrentLevel) { - (static_cast(context))->OnSuccessResponse_14(currentLevel); + (static_cast(context))->OnSuccessResponse_16(startUpCurrentLevel); } // @@ -17961,139 +18206,134 @@ class Test_TC_LVL_3_1 : public TestCommand return WaitForCommissionee(); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_1() + CHIP_ERROR TestReadsTheOnOffTransitionTimeAttributeFromTheDut_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_1, OnFailureCallback_1)); return CHIP_NO_ERROR; } void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_1(uint8_t currentLevel) + void OnSuccessResponse_1(uint16_t onOffTransitionTime) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); NextTest(); } - CHIP_ERROR TestReadsMaxLevelAttributeFromDut_2() + CHIP_ERROR TestWritesTheOnOffTransitionTimeAttributeOnTheDut_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2)); + uint16_t onOffTransitionTimeArgument; + onOffTransitionTimeArgument = 10U; + + ReturnErrorOnFailure(cluster.WriteAttribute( + onOffTransitionTimeArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); return CHIP_NO_ERROR; } void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t maxLevel) - { - VerifyOrReturn(CheckValue("maxLevel", maxLevel, 255)); - - NextTest(); - } + void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestSendsAMoveUpCommand_3() + CHIP_ERROR TestReadsTheOnOffTransitionTimeAttributeFromTheDut_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 200; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_3(status); - }; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); return CHIP_NO_ERROR; } void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestWait3000ms_4() + void OnSuccessResponse_3(uint16_t onOffTransitionTime) { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); + VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 10U)); + + NextTest(); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_5() + CHIP_ERROR TestWritesDefaultValueOfOnOffTransitionTimeAttribute_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5)); + uint16_t onOffTransitionTimeArgument; + onOffTransitionTimeArgument = 0U; + + ReturnErrorOnFailure(cluster.WriteAttribute( + onOffTransitionTimeArgument, this, OnSuccessCallback_4, OnFailureCallback_4)); return CHIP_NO_ERROR; } - void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_5(uint8_t currentLevel) + void OnSuccessResponse_4() { NextTest(); } + + CHIP_ERROR TestWritesTheOnLevelAttributeOnTheDut_5() { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 255)); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - NextTest(); + chip::app::DataModel::Nullable onLevelArgument; + onLevelArgument.SetNonNull(); + onLevelArgument.Value() = 1; + + ReturnErrorOnFailure(cluster.WriteAttribute( + onLevelArgument, this, OnSuccessCallback_5, OnFailureCallback_5)); + return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMinLevelAttributeFromDut_6() + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5() { NextTest(); } + + CHIP_ERROR TestReadsTheOnLevelAttributeFromTheDut_6() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_6, OnFailureCallback_6)); return CHIP_NO_ERROR; } void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_6(uint8_t minLevel) + void OnSuccessResponse_6(const chip::app::DataModel::Nullable & onLevel) { - VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); + VerifyOrReturn(CheckValueNonNull("onLevel", onLevel)); + VerifyOrReturn(CheckValue("onLevel.Value()", onLevel.Value(), 1)); NextTest(); } - CHIP_ERROR TestSendsAMoveDownCommand_7() + CHIP_ERROR TestWritesTheOnTransitionTimeAttributeOnTheDut_7() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - - RequestType request; - request.moveMode = static_cast(1); - request.rate = 250; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); - }; + chip::app::DataModel::Nullable onTransitionTimeArgument; + onTransitionTimeArgument.SetNonNull(); + onTransitionTimeArgument.Value() = 100U; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + ReturnErrorOnFailure(cluster.WriteAttribute( + onTransitionTimeArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); return CHIP_NO_ERROR; } @@ -18101,52 +18341,68 @@ class Test_TC_LVL_3_1 : public TestCommand void OnSuccessResponse_7() { NextTest(); } - CHIP_ERROR TestWait3000ms_8() - { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } - - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() + CHIP_ERROR TestReadsTheOnTransitionTimeAttributeFromTheDut_8() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8)); return CHIP_NO_ERROR; } - void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_8(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_9(uint8_t currentLevel) + void OnSuccessResponse_8(const chip::app::DataModel::Nullable & onTransitionTime) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + VerifyOrReturn(CheckValueNonNull("onTransitionTime", onTransitionTime)); + VerifyOrReturn(CheckValue("onTransitionTime.Value()", onTransitionTime.Value(), 100U)); NextTest(); } - CHIP_ERROR TestWriteDefaultMoveRateAttributeFromDut_10() + CHIP_ERROR TestWritesTheOffTransitionTimeAttributeOnTheDut_9() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - chip::app::DataModel::Nullable defaultMoveRateArgument; - defaultMoveRateArgument.SetNonNull(); - defaultMoveRateArgument.Value() = 20; + chip::app::DataModel::Nullable offTransitionTimeArgument; + offTransitionTimeArgument.SetNonNull(); + offTransitionTimeArgument.Value() = 100U; - ReturnErrorOnFailure(cluster.WriteAttribute( - defaultMoveRateArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); + ReturnErrorOnFailure(cluster.WriteAttribute( + offTransitionTimeArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestReadsTheOffTransitionTimeAttributeFromTheDut_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10)); return CHIP_NO_ERROR; } void OnFailureResponse_10(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_10() { NextTest(); } + void OnSuccessResponse_10(const chip::app::DataModel::Nullable & offTransitionTime) + { + VerifyOrReturn(CheckValueNonNull("offTransitionTime", offTransitionTime)); + VerifyOrReturn(CheckValue("offTransitionTime.Value()", offTransitionTime.Value(), 100U)); - CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_11() + NextTest(); + } + + CHIP_ERROR TestReadsTheDefaultMoveRateAttributeFromTheDut_11() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; @@ -18162,31 +18418,23 @@ class Test_TC_LVL_3_1 : public TestCommand void OnSuccessResponse_11(const chip::app::DataModel::Nullable & defaultMoveRate) { VerifyOrReturn(CheckValueNonNull("defaultMoveRate", defaultMoveRate)); - VerifyOrReturn(CheckValue("defaultMoveRate.Value()", defaultMoveRate.Value(), 20)); + VerifyOrReturn(CheckValue("defaultMoveRate.Value()", defaultMoveRate.Value(), 0)); NextTest(); } - CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_12() + CHIP_ERROR TestWritesTheDefaultMoveRateAttributeOnTheDut_12() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 255; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_12(); - }; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_12(status); - }; + chip::app::DataModel::Nullable defaultMoveRateArgument; + defaultMoveRateArgument.SetNonNull(); + defaultMoveRateArgument.Value() = 100; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + ReturnErrorOnFailure(cluster.WriteAttribute( + defaultMoveRateArgument, this, OnSuccessCallback_12, OnFailureCallback_12)); return CHIP_NO_ERROR; } @@ -18194,52 +18442,58 @@ class Test_TC_LVL_3_1 : public TestCommand void OnSuccessResponse_12() { NextTest(); } - CHIP_ERROR TestWait100ms_13() + CHIP_ERROR TestReadsTheDefaultMoveRateAttributeFromTheDut_13() { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_13, OnFailureCallback_13)); + return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_14() + void OnFailureResponse_13(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13(const chip::app::DataModel::Nullable & defaultMoveRate) + { + VerifyOrReturn(CheckValueNonNull("defaultMoveRate", defaultMoveRate)); + VerifyOrReturn(CheckValue("defaultMoveRate.Value()", defaultMoveRate.Value(), 100)); + + NextTest(); + } + + CHIP_ERROR TestReadsTheStartUpCurrentLevelAttributeFromTheDut_14() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_14, OnFailureCallback_14)); return CHIP_NO_ERROR; } void OnFailureResponse_14(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_14(uint8_t currentLevel) + void OnSuccessResponse_14(uint8_t startUpCurrentLevel) { - VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, 255)); + VerifyOrReturn(CheckValue("startUpCurrentLevel", startUpCurrentLevel, 0)); NextTest(); } - CHIP_ERROR TestResetLevelTo254_15() + CHIP_ERROR TestWritesTheStartUpCurrentLevelAttributeOnTheDut_15() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; - - RequestType request; - request.level = 254; - request.transitionTime = 0U; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(); - }; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_15(status); - }; + uint8_t startUpCurrentLevelArgument; + startUpCurrentLevelArgument = 1; - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + ReturnErrorOnFailure(cluster.WriteAttribute( + startUpCurrentLevelArgument, this, OnSuccessCallback_15, OnFailureCallback_15)); return CHIP_NO_ERROR; } @@ -18247,17 +18501,31 @@ class Test_TC_LVL_3_1 : public TestCommand void OnSuccessResponse_15() { NextTest(); } - CHIP_ERROR TestWait100ms_16() + CHIP_ERROR TestReadsTheStartUpCurrentLevelAttributeFromTheDut_16() { - SetIdentity(kIdentityAlpha); - return WaitForMs(100); + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_16, OnFailureCallback_16)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_16(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_16(uint8_t startUpCurrentLevel) + { + VerifyOrReturn(CheckValue("startUpCurrentLevel", startUpCurrentLevel, 1)); + + NextTest(); } }; -class Test_TC_LVL_4_1 : public TestCommand +class Test_TC_LVL_3_1 : public TestCommand { public: - Test_TC_LVL_4_1() : TestCommand("Test_TC_LVL_4_1"), mTestIndex(0) + Test_TC_LVL_3_1() : TestCommand("Test_TC_LVL_3_1"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -18270,12 +18538,12 @@ class Test_TC_LVL_4_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_4_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_3_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_4_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_3_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -18293,48 +18561,64 @@ class Test_TC_LVL_4_1 : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Sending on command\n"); - err = TestSendingOnCommand_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the MinLevel attribute\n"); + err = TestReadsTheMinLevelAttribute_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); - err = TestWait3000ms_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the MaxLevel attribute\n"); + err = TestReadsTheMaxLevelAttribute_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends step down command to DUT\n"); - err = TestSendsStepDownCommandToDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 100ms\n"); + err = TestWait100ms_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 3000ms\n"); - err = TestWait3000ms_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Sends a Step up command\n"); - err = TestSendsAStepUpCommand_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 200ms\n"); + err = TestWait200ms_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 3000ms\n"); - err = TestWait3000ms_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads current level attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : reads On Off Transition Time attribute from DUT\n"); + err = TestReadsOnOffTransitionTimeAttributeFromDut_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Sending off command\n"); - err = TestSendingOffCommand_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : sends a Move to level command\n"); + err = TestSendsAMoveToLevelCommand_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 10ms\n"); + err = TestWait10ms_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Reset level to 254\n"); + err = TestResetLevelTo254_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Wait 100ms\n"); + err = TestWait100ms_15(); break; } @@ -18347,39 +18631,79 @@ class Test_TC_LVL_4_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; + const uint16_t mTestCount = 16; chip::Optional mCluster; chip::Optional mEndpoint; - static void OnFailureCallback_4(void * context, EmberAfStatus status) + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t currentLevel) { - (static_cast(context))->OnFailureResponse_4(status); + (static_cast(context))->OnSuccessResponse_1(currentLevel); } - static void OnSuccessCallback_4(void * context, uint8_t currentLevel) + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint8_t minLevel) { - (static_cast(context))->OnSuccessResponse_4(currentLevel); + (static_cast(context))->OnSuccessResponse_2(minLevel); } - static void OnFailureCallback_7(void * context, EmberAfStatus status) + static void OnFailureCallback_3(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); + (static_cast(context))->OnFailureResponse_3(status); } - static void OnSuccessCallback_7(void * context, uint8_t currentLevel) + static void OnSuccessCallback_3(void * context, uint8_t maxLevel) + { + (static_cast(context))->OnSuccessResponse_3(maxLevel); + } + + static void OnFailureCallback_6(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_6(currentLevel); + } + + static void OnFailureCallback_9(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, uint8_t currentLevel) { - (static_cast(context))->OnSuccessResponse_7(currentLevel); + (static_cast(context))->OnSuccessResponse_9(currentLevel); } static void OnFailureCallback_10(void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_10(status); + (static_cast(context))->OnFailureResponse_10(status); } - static void OnSuccessCallback_10(void * context, uint8_t currentLevel) + static void OnSuccessCallback_10(void * context, uint16_t onOffTransitionTime) + { + (static_cast(context))->OnSuccessResponse_10(onOffTransitionTime); + } + + static void OnFailureCallback_13(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_13(status); + } + + static void OnSuccessCallback_13(void * context, uint8_t currentLevel) { - (static_cast(context))->OnSuccessResponse_10(currentLevel); + (static_cast(context))->OnSuccessResponse_13(currentLevel); } // @@ -18392,219 +18716,2057 @@ class Test_TC_LVL_4_1 : public TestCommand return WaitForCommissionee(); } - CHIP_ERROR TestSendingOnCommand_1() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - RequestType request; + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); - }; + void OnSuccessResponse_1(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + NextTest(); + } + + CHIP_ERROR TestReadsTheMinLevelAttribute_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); return CHIP_NO_ERROR; } - void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_1() { NextTest(); } + void OnSuccessResponse_2(uint8_t minLevel) + { + VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_2() + NextTest(); + } + + CHIP_ERROR TestReadsTheMaxLevelAttribute_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint8_t maxLevel) + { + VerifyOrReturn(CheckValue("maxLevel", maxLevel, 255)); + + NextTest(); + } + + CHIP_ERROR TestSendsAMoveToLevelCommand_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; RequestType request; - request.stepMode = static_cast(1); - request.stepSize = 126; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; + request.level = 64; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); + (static_cast(context))->OnSuccessResponse_4(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); + (static_cast(context))->OnFailureResponse_4(status); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_2() { NextTest(); } + void OnSuccessResponse_4() { NextTest(); } - CHIP_ERROR TestWait3000ms_3() + CHIP_ERROR TestWait100ms_5() { SetIdentity(kIdentityAlpha); - return WaitForMs(3000); + return WaitForMs(100); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_6() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4)); + this, OnSuccessCallback_6, OnFailureCallback_6)); return CHIP_NO_ERROR; } - void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_4(uint8_t currentLevel) + void OnSuccessResponse_6(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); NextTest(); } - CHIP_ERROR TestSendsStepDownCommandToDut_5() + CHIP_ERROR TestSendsAMoveToLevelCommand_7() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; RequestType request; - request.stepMode = static_cast(1); - request.stepSize = 64; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; + request.level = 128; + request.transitionTime = 1U; + request.optionMask = 1; + request.optionOverride = 1; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); + (static_cast(context))->OnSuccessResponse_7(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_5(status); + (static_cast(context))->OnFailureResponse_7(status); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_5() { NextTest(); } + void OnSuccessResponse_7() { NextTest(); } - CHIP_ERROR TestWait3000ms_6() + CHIP_ERROR TestWait200ms_8() { SetIdentity(kIdentityAlpha); - return WaitForMs(3000); + return WaitForMs(200); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_7() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7)); + this, OnSuccessCallback_9, OnFailureCallback_9)); return CHIP_NO_ERROR; } - void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_7(uint8_t currentLevel) + void OnSuccessResponse_9(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); NextTest(); } - CHIP_ERROR TestSendsAStepUpCommand_8() + CHIP_ERROR TestReadsOnOffTransitionTimeAttributeFromDut_10() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(uint16_t onOffTransitionTime) + { + VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); + + NextTest(); + } + + CHIP_ERROR TestSendsAMoveToLevelCommand_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; RequestType request; - request.stepMode = static_cast(0); - request.stepSize = 64; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; + request.level = 254; + request.transitionTime = 65535U; + request.optionMask = 1; + request.optionOverride = 1; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); + (static_cast(context))->OnSuccessResponse_11(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_8(status); + (static_cast(context))->OnFailureResponse_11(status); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_8(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_8() { NextTest(); } + void OnSuccessResponse_11() { NextTest(); } - CHIP_ERROR TestWait3000ms_9() + CHIP_ERROR TestWait10ms_12() { SetIdentity(kIdentityAlpha); - return WaitForMs(3000); + return WaitForMs(10); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_13() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10)); + this, OnSuccessCallback_13, OnFailureCallback_13)); return CHIP_NO_ERROR; } - void OnFailureResponse_10(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_13(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_10(uint8_t currentLevel) + void OnSuccessResponse_13(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); NextTest(); } - CHIP_ERROR TestSendingOffCommand_11() + CHIP_ERROR TestResetLevelTo254_14() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; RequestType request; + request.level = 254; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_11(); + (static_cast(context))->OnSuccessResponse_14(); }; auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_11(status); + (static_cast(context))->OnFailureResponse_14(status); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } + void OnFailureResponse_14(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_14() { NextTest(); } + + CHIP_ERROR TestWait100ms_15() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } +}; + +class Test_TC_LVL_4_1 : public TestCommand +{ +public: + Test_TC_LVL_4_1() : TestCommand("Test_TC_LVL_4_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_4_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_4_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : reads max level attribute from DUT\n"); + err = TestReadsMaxLevelAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : sends a Move up command\n"); + err = TestSendsAMoveUpCommand_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); + err = TestWait3000ms_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : reads min level attribute from DUT\n"); + err = TestReadsMinLevelAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : sends a Move down command\n"); + err = TestSendsAMoveDownCommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 3000ms\n"); + err = TestWait3000ms_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Write default move rate attribute from DUT\n"); + err = TestWriteDefaultMoveRateAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : reads default move rate attribute from DUT\n"); + err = TestReadsDefaultMoveRateAttributeFromDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : sends a Move up command at default move rate\n"); + err = TestSendsAMoveUpCommandAtDefaultMoveRate_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Wait 100ms\n"); + err = TestWait100ms_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Reset level to 254\n"); + err = TestResetLevelTo254_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Wait 100ms\n"); + err = TestWait100ms_16(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 17; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_1(currentLevel); + } + + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, uint8_t maxLevel) + { + (static_cast(context))->OnSuccessResponse_2(maxLevel); + } + + static void OnFailureCallback_5(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_5(currentLevel); + } + + static void OnFailureCallback_6(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, uint8_t minLevel) + { + (static_cast(context))->OnSuccessResponse_6(minLevel); + } + + static void OnFailureCallback_9(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_9(status); + } + + static void OnSuccessCallback_9(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_9(currentLevel); + } + + static void OnFailureCallback_10(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } + + static void OnFailureCallback_11(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_11(status); + } + + static void OnSuccessCallback_11(void * context, const chip::app::DataModel::Nullable & defaultMoveRate) + { + (static_cast(context))->OnSuccessResponse_11(defaultMoveRate); + } + + static void OnFailureCallback_14(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_14(status); + } + + static void OnSuccessCallback_14(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_14(currentLevel); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + + NextTest(); + } + + CHIP_ERROR TestReadsMaxLevelAttributeFromDut_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(uint8_t maxLevel) + { + VerifyOrReturn(CheckValue("maxLevel", maxLevel, 255)); + + NextTest(); + } + + CHIP_ERROR TestSendsAMoveUpCommand_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + + RequestType request; + request.moveMode = static_cast(0); + request.rate = 200; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_3(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_3(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR TestWait3000ms_4() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 255)); + + NextTest(); + } + + CHIP_ERROR TestReadsMinLevelAttributeFromDut_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(uint8_t minLevel) + { + VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); + + NextTest(); + } + + CHIP_ERROR TestSendsAMoveDownCommand_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + + RequestType request; + request.moveMode = static_cast(1); + request.rate = 250; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7() { NextTest(); } + + CHIP_ERROR TestWait3000ms_8() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_9, OnFailureCallback_9)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + + NextTest(); + } + + CHIP_ERROR TestWriteDefaultMoveRateAttributeFromDut_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::app::DataModel::Nullable defaultMoveRateArgument; + defaultMoveRateArgument.SetNonNull(); + defaultMoveRateArgument.Value() = 20; + + ReturnErrorOnFailure(cluster.WriteAttribute( + defaultMoveRateArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10() { NextTest(); } + + CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_11, OnFailureCallback_11)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11(const chip::app::DataModel::Nullable & defaultMoveRate) + { + VerifyOrReturn(CheckValueNonNull("defaultMoveRate", defaultMoveRate)); + VerifyOrReturn(CheckValue("defaultMoveRate.Value()", defaultMoveRate.Value(), 20)); + + NextTest(); + } + + CHIP_ERROR TestSendsAMoveUpCommandAtDefaultMoveRate_12() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + + RequestType request; + request.moveMode = static_cast(0); + request.rate = 255; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_12(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_12(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_12() { NextTest(); } + + CHIP_ERROR TestWait100ms_13() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_14() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_14, OnFailureCallback_14)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_14(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_14(uint8_t currentLevel) + { + VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, 255)); + + NextTest(); + } + + CHIP_ERROR TestResetLevelTo254_15() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + + RequestType request; + request.level = 254; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_15(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_15(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_15(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_15() { NextTest(); } + + CHIP_ERROR TestWait100ms_16() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } +}; + +class Test_TC_LVL_5_1 : public TestCommand +{ +public: + Test_TC_LVL_5_1() : TestCommand("Test_TC_LVL_5_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_5_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_5_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Sending on command\n"); + err = TestSendingOnCommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to 0x80\n"); + err = TestPreconditionDutLevelIsSetTo0x80_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); + err = TestWait3000ms_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Sends step down command to DUT\n"); + err = TestSendsStepDownCommandToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 3000ms\n"); + err = TestWait3000ms_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Sends a Step up command\n"); + err = TestSendsAStepUpCommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 3000ms\n"); + err = TestWait3000ms_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Reads current level attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Reset level to 254\n"); + err = TestResetLevelTo254_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 100ms\n"); + err = TestWait100ms_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Sending off command\n"); + err = TestSendingOffCommand_13(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 14; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_4(currentLevel); + } + + static void OnFailureCallback_7(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_7(currentLevel); + } + + static void OnFailureCallback_10(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_10(status); + } + + static void OnSuccessCallback_10(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_10(currentLevel); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestSendingOnCommand_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + + RequestType request; + request.stepMode = static_cast(1); + request.stepSize = 126; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestWait3000ms_3() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + + NextTest(); + } + + CHIP_ERROR TestSendsStepDownCommandToDut_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + + RequestType request; + request.stepMode = static_cast(1); + request.stepSize = 64; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_5(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_5(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5() { NextTest(); } + + CHIP_ERROR TestWait3000ms_6() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + + NextTest(); + } + + CHIP_ERROR TestSendsAStepUpCommand_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + + RequestType request; + request.stepMode = static_cast(0); + request.stepSize = 64; + request.transitionTime = 20U; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_8(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_8(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8() { NextTest(); } + + CHIP_ERROR TestWait3000ms_9() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(3000); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_10(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + + NextTest(); + } + + CHIP_ERROR TestResetLevelTo254_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + + RequestType request; + request.level = 254; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestWait100ms_12() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + + CHIP_ERROR TestSendingOffCommand_13() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_13(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_13(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_13(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_13() { NextTest(); } +}; + +class Test_TC_LVL_6_1 : public TestCommand +{ +public: + Test_TC_LVL_6_1() : TestCommand("Test_TC_LVL_6_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_6_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_6_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 : Sending on command\n"); + err = TestSendingOnCommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: set DUT to lowest point\n"); + err = TestPreconditionSetDutToLowestPoint_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 100ms\n"); + err = TestWait100ms_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Sends a move up command to DUT\n"); + err = TestSendsAMoveUpCommandToDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 2000ms\n"); + err = TestWait2000ms_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Sends stop command to DUT\n"); + err = TestSendsStopCommandToDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Reset level to 254\n"); + err = TestResetLevelTo254_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Wait 100ms\n"); + err = TestWait100ms_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Sending off command\n"); + err = TestSendingOffCommand_11(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_4(currentLevel); + } + + static void OnFailureCallback_8(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_8(status); + } + + static void OnSuccessCallback_8(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_8(currentLevel); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestSendingOnCommand_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR TestPreconditionSetDutToLowestPoint_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + + RequestType request; + request.level = 0; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_2(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestWait100ms_3() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 0)); + + NextTest(); + } + + CHIP_ERROR TestSendsAMoveUpCommandToDut_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; + + RequestType request; + request.moveMode = static_cast(0); + request.rate = 1; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_5(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_5(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5() { NextTest(); } + + CHIP_ERROR TestWait2000ms_6() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(2000); + } + + CHIP_ERROR TestSendsStopCommandToDut_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::Stop::Type; + + RequestType request; + request.optionMask = 0; + request.optionOverride = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_7(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_7(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7() { NextTest(); } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_8(uint8_t currentLevel) + { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 2)); + + NextTest(); + } + + CHIP_ERROR TestResetLevelTo254_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; + + RequestType request; + request.level = 254; + request.transitionTime = 0U; + request.optionMask = 1; + request.optionOverride = 1; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_9(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_9(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestWait100ms_10() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(100); + } + + CHIP_ERROR TestSendingOffCommand_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_11(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_11() { NextTest(); } +}; + +class Test_TC_MC_1_1 : public TestCommand +{ +public: + Test_TC_MC_1_1() : TestCommand("Test_TC_MC_1_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, + " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); + err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 3; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) + { + (static_cast(context))->OnSuccessResponse_1(clusterRevision); + } + + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaInputClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint16_t clusterRevision) + { + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaInputClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + uint16_t clusterRevisionArgument; + clusterRevisionArgument = 1U; + + ReturnErrorOnFailure(cluster.WriteAttribute( + clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) + { + VerifyOrReturn(CheckValue("status", status, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } + + void OnSuccessResponse_2() { ThrowSuccessResponse(); } +}; + +class Test_TC_MC_2_1 : public TestCommand +{ +public: + Test_TC_MC_2_1() : TestCommand("Test_TC_MC_2_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Put the device into low power mode\n"); + err = TestPutTheDeviceIntoLowPowerMode_1(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 2; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestPutTheDeviceIntoLowPowerMode_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::LowPower::Commands::Sleep::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, EmberAfStatus status) { + (static_cast(context))->OnFailureResponse_1(status); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1() { NextTest(); } +}; + +class Test_TC_MC_3_1 : public TestCommand +{ +public: + Test_TC_MC_3_1() : TestCommand("Test_TC_MC_3_1"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } +}; + +class Test_TC_MC_3_2 : public TestCommand +{ +public: + Test_TC_MC_3_2() : TestCommand("Test_TC_MC_3_2"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_2\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } +}; + +class Test_TC_MC_3_3 : public TestCommand +{ +public: + Test_TC_MC_3_3() : TestCommand("Test_TC_MC_3_3"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } +}; + +class Test_TC_MC_3_4 : public TestCommand +{ +public: + Test_TC_MC_3_4() : TestCommand("Test_TC_MC_3_4"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } +}; + +class Test_TC_MC_3_5 : public TestCommand +{ +public: + Test_TC_MC_3_5() : TestCommand("Test_TC_MC_3_5"), mTestIndex(0) + { + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // - void OnSuccessResponse_11() { NextTest(); } + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } }; -class Test_TC_LVL_5_1 : public TestCommand +class Test_TC_MC_3_6 : public TestCommand { public: - Test_TC_LVL_5_1() : TestCommand("Test_TC_LVL_5_1"), mTestIndex(0) + Test_TC_MC_3_6() : TestCommand("Test_TC_MC_3_6"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -18617,12 +20779,12 @@ class Test_TC_LVL_5_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_LVL_5_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_LVL_5_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -18639,34 +20801,6 @@ class Test_TC_LVL_5_1 : public TestCommand 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 : Sending on command\n"); - err = TestSendingOnCommand_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); - err = TestWait3000ms_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Sends a move up command to DUT\n"); - err = TestSendsAMoveUpCommandToDut_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Wait 3000ms\n"); - err = TestWait3000ms_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Sends stop command to DUT\n"); - err = TestSendsStopCommandToDut_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Sending off command\n"); - err = TestSendingOffCommand_7(); - break; } if (CHIP_NO_ERROR != err) @@ -18678,7 +20812,7 @@ class Test_TC_LVL_5_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 1; chip::Optional mCluster; chip::Optional mEndpoint; @@ -18692,150 +20826,142 @@ class Test_TC_LVL_5_1 : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(); } +}; - CHIP_ERROR TestSendingOnCommand_1() +class Test_TC_MC_3_7 : public TestCommand +{ +public: + Test_TC_MC_3_7() : TestCommand("Test_TC_MC_3_7"), mTestIndex(0) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); } - void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1() { NextTest(); } - - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_2() + /////////// TestCommand Interface ///////// + void NextTest() override { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; + CHIP_ERROR err = CHIP_NO_ERROR; - RequestType request; - request.stepMode = static_cast(0); - request.stepSize = 128; - request.transitionTime = 20U; - request.optionMask = 0; - request.optionOverride = 0; + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_2(); - }; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_2(status); - }; + Wait(); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + // 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; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - void OnSuccessResponse_2() { NextTest(); } + chip::Optional mCluster; + chip::Optional mEndpoint; - CHIP_ERROR TestWait3000ms_3() + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() { SetIdentity(kIdentityAlpha); - return WaitForMs(3000); + return WaitForCommissionee(); } +}; - CHIP_ERROR TestSendsAMoveUpCommandToDut_4() +class Test_TC_MC_3_8 : public TestCommand +{ +public: + Test_TC_MC_3_8() : TestCommand("Test_TC_MC_3_8"), mTestIndex(0) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; - - RequestType request; - request.moveMode = static_cast(0); - request.rate = 1; - request.optionMask = 1; - request.optionOverride = 1; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_4(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_4(status); - }; - - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); } - void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } - - void OnSuccessResponse_4() { NextTest(); } - - CHIP_ERROR TestWait3000ms_5() + /////////// TestCommand Interface ///////// + void NextTest() override { - SetIdentity(kIdentityAlpha); - return WaitForMs(3000); - } + CHIP_ERROR err = CHIP_NO_ERROR; - CHIP_ERROR TestSendsStopCommandToDut_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LevelControl::Commands::Stop::Type; + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); + } - RequestType request; - request.optionMask = 0; - request.optionOverride = 0; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); - }; + Wait(); - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_6(status); - }; + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } - - void OnSuccessResponse_6() { NextTest(); } - - CHIP_ERROR TestSendingOffCommand_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; - - RequestType request; +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_7(); - }; + chip::Optional mCluster; + chip::Optional mEndpoint; - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_7(status); - }; + // + // Tests methods + // - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); - return CHIP_NO_ERROR; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); } - - void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } - - void OnSuccessResponse_7() { NextTest(); } }; -class Test_TC_MC_1_1 : public TestCommand +class Test_TC_MC_3_9 : public TestCommand { public: - Test_TC_MC_1_1() : TestCommand("Test_TC_MC_1_1"), mTestIndex(0) + Test_TC_MC_3_9() : TestCommand("Test_TC_MC_3_9"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -18848,12 +20974,12 @@ class Test_TC_MC_1_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -18870,15 +20996,6 @@ class Test_TC_MC_1_1 : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); - break; } if (CHIP_NO_ERROR != err) @@ -18890,27 +21007,75 @@ class Test_TC_MC_1_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 1; chip::Optional mCluster; chip::Optional mEndpoint; - static void OnFailureCallback_1(void * context, EmberAfStatus status) + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() { - (static_cast(context))->OnFailureResponse_1(status); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); } +}; - static void OnSuccessCallback_1(void * context, uint16_t clusterRevision) +class Test_TC_MC_3_10 : public TestCommand +{ +public: + Test_TC_MC_3_10() : TestCommand("Test_TC_MC_3_10"), mTestIndex(0) { - (static_cast(context))->OnSuccessResponse_1(clusterRevision); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); } - static void OnFailureCallback_2(void * context, EmberAfStatus status) + /////////// TestCommand Interface ///////// + void NextTest() override { - (static_cast(context))->OnFailureResponse_2(status); + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; // // Tests methods @@ -18921,53 +21086,77 @@ class Test_TC_MC_1_1 : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(); } +}; - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() +class Test_TC_MC_3_11 : public TestCommand +{ +public: + Test_TC_MC_3_11() : TestCommand("Test_TC_MC_3_11"), mTestIndex(0) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1)); - return CHIP_NO_ERROR; + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); } - void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } - - void OnSuccessResponse_1(uint16_t clusterRevision) + /////////// TestCommand Interface ///////// + void NextTest() override { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); - NextTest(); - } + CHIP_ERROR err = CHIP_NO_ERROR; - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::MediaInputClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); + } - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; + 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; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } } - void OnFailureResponse_2(EmberAfStatus status) +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 1; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() { - VerifyOrReturn(CheckValue("status", status, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } }; -class Test_TC_MC_2_1 : public TestCommand +class Test_TC_MC_5_1 : public TestCommand { public: - Test_TC_MC_2_1() : TestCommand("Test_TC_MC_2_1"), mTestIndex(0) + Test_TC_MC_5_1() : TestCommand("Test_TC_MC_5_1"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -18980,12 +21169,12 @@ class Test_TC_MC_2_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19003,8 +21192,8 @@ class Test_TC_MC_2_1 : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Put the device into low power mode\n"); - err = TestPutTheDeviceIntoLowPowerMode_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads the ChannelList attribute from the DUT\n"); + err = TestReadsTheChannelListAttributeFromTheDut_1(); break; } @@ -19022,6 +21211,18 @@ class Test_TC_MC_2_1 : public TestCommand chip::Optional mCluster; chip::Optional mEndpoint; + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1( + void * context, + const chip::app::DataModel::DecodableList & channelList) + { + (static_cast(context))->OnSuccessResponse_1(channelList); + } + // // Tests methods // @@ -19032,34 +21233,31 @@ class Test_TC_MC_2_1 : public TestCommand return WaitForCommissionee(); } - CHIP_ERROR TestPutTheDeviceIntoLowPowerMode_1() + CHIP_ERROR TestReadsTheChannelListAttributeFromTheDut_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - using RequestType = chip::app::Clusters::LowPower::Commands::Sleep::Type; - - RequestType request; - - auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_1(); - }; - - auto failure = [](void * context, EmberAfStatus status) { - (static_cast(context))->OnFailureResponse_1(status); - }; + chip::Controller::ChannelClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); return CHIP_NO_ERROR; } void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } - void OnSuccessResponse_1() { NextTest(); } + void OnSuccessResponse_1( + const chip::app::DataModel::DecodableList & channelList) + { + VerifyOrReturn(CheckConstraintType("channelList", "", "list")); + NextTest(); + } }; -class Test_TC_MC_3_1 : public TestCommand +class Test_TC_MC_5_2 : public TestCommand { public: - Test_TC_MC_3_1() : TestCommand("Test_TC_MC_3_1"), mTestIndex(0) + Test_TC_MC_5_2() : TestCommand("Test_TC_MC_5_2"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19072,12 +21270,12 @@ class Test_TC_MC_3_1 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19094,6 +21292,10 @@ class Test_TC_MC_3_1 : public TestCommand 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 : log a command\n"); + err = TestLogACommand_1(); + break; } if (CHIP_NO_ERROR != err) @@ -19105,7 +21307,7 @@ class Test_TC_MC_3_1 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 2; chip::Optional mCluster; chip::Optional mEndpoint; @@ -19119,12 +21321,18 @@ class Test_TC_MC_3_1 : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(); } + + CHIP_ERROR TestLogACommand_1() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("verify that the channel has changed on the device."); + } }; -class Test_TC_MC_3_2 : public TestCommand +class Test_TC_MC_5_3 : public TestCommand { public: - Test_TC_MC_3_2() : TestCommand("Test_TC_MC_3_2"), mTestIndex(0) + Test_TC_MC_5_3() : TestCommand("Test_TC_MC_5_3"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19137,12 +21345,12 @@ class Test_TC_MC_3_2 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_2\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_5_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_2\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_5_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19159,6 +21367,10 @@ class Test_TC_MC_3_2 : public TestCommand 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 : log a command\n"); + err = TestLogACommand_1(); + break; } if (CHIP_NO_ERROR != err) @@ -19170,7 +21382,7 @@ class Test_TC_MC_3_2 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 2; chip::Optional mCluster; chip::Optional mEndpoint; @@ -19184,12 +21396,18 @@ class Test_TC_MC_3_2 : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(); } + + CHIP_ERROR TestLogACommand_1() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("verify that the channel has changed on the device"); + } }; -class Test_TC_MC_3_3 : public TestCommand +class Test_TC_MC_6_1 : public TestCommand { public: - Test_TC_MC_3_3() : TestCommand("Test_TC_MC_3_3"), mTestIndex(0) + Test_TC_MC_6_1() : TestCommand("Test_TC_MC_6_1"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19202,12 +21420,12 @@ class Test_TC_MC_3_3 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_3\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_3\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19224,6 +21442,26 @@ class Test_TC_MC_3_3 : public TestCommand 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 : log a command\n"); + err = TestLogACommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); + err = TestLogACommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the playback state attribute\n"); + err = TestReadsThePlaybackStateAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); + err = TestLogACommand_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); + err = TestLogACommand_5(); + break; } if (CHIP_NO_ERROR != err) @@ -19233,28 +21471,82 @@ class Test_TC_MC_3_3 : public TestCommand } } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 6; + + chip::Optional mCluster; + chip::Optional mEndpoint; + + static void OnFailureCallback_3(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum playbackState) + { + (static_cast(context))->OnSuccessResponse_3(playbackState); + } + + // + // Tests methods + // + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(); + } + + CHIP_ERROR TestLogACommand_1() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that media is paused"); + } + + CHIP_ERROR TestLogACommand_2() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is playing"); + } + + CHIP_ERROR TestReadsThePlaybackStateAttribute_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaPlaybackClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } - chip::Optional mCluster; - chip::Optional mEndpoint; + void OnSuccessResponse_3(chip::app::Clusters::MediaPlayback::PlaybackStateEnum playbackState) + { + VerifyOrReturn(CheckValue("playbackState", playbackState, 0)); - // - // Tests methods - // + NextTest(); + } - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestLogACommand_4() { SetIdentity(kIdentityAlpha); - return WaitForCommissionee(); + return UserPrompt("Physically verify that the media is paused"); + } + + CHIP_ERROR TestLogACommand_5() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is stoped"); } }; -class Test_TC_MC_3_4 : public TestCommand +class Test_TC_MC_6_2 : public TestCommand { public: - Test_TC_MC_3_4() : TestCommand("Test_TC_MC_3_4"), mTestIndex(0) + Test_TC_MC_6_2() : TestCommand("Test_TC_MC_6_2"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19267,12 +21559,12 @@ class Test_TC_MC_3_4 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_4\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_4\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19289,6 +21581,38 @@ class Test_TC_MC_3_4 : public TestCommand 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 : log a command\n"); + err = TestLogACommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); + err = TestLogACommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the CurrentState attribute\n"); + err = TestReadsTheCurrentStateAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : log a command\n"); + err = TestLogACommand_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); + err = TestLogACommand_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); + err = TestLogACommand_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : log a command\n"); + err = TestLogACommand_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); + err = TestLogACommand_8(); + break; } if (CHIP_NO_ERROR != err) @@ -19300,11 +21624,21 @@ class Test_TC_MC_3_4 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 9; chip::Optional mCluster; chip::Optional mEndpoint; + static void OnFailureCallback_3(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum playbackState) + { + (static_cast(context))->OnSuccessResponse_3(playbackState); + } + // // Tests methods // @@ -19314,77 +21648,74 @@ class Test_TC_MC_3_4 : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(); } -}; -class Test_TC_MC_3_5 : public TestCommand -{ -public: - Test_TC_MC_3_5() : TestCommand("Test_TC_MC_3_5"), mTestIndex(0) + CHIP_ERROR TestLogACommand_1() { - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that media is paused"); } - /////////// TestCommand Interface ///////// - void NextTest() override + CHIP_ERROR TestLogACommand_2() { - CHIP_ERROR err = CHIP_NO_ERROR; + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is playing"); + } - if (0 == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_5\n"); - } + CHIP_ERROR TestReadsTheCurrentStateAttribute_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaPlaybackClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); - if (mTestCount == mTestIndex) - { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_5\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } - Wait(); + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) - { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - } + void OnSuccessResponse_3(chip::app::Clusters::MediaPlayback::PlaybackStateEnum playbackState) + { + VerifyOrReturn(CheckValue("playbackState", playbackState, 0)); - if (CHIP_NO_ERROR != err) - { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } + NextTest(); } -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + CHIP_ERROR TestLogACommand_4() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the media is started over"); + } - chip::Optional mCluster; - chip::Optional mEndpoint; + CHIP_ERROR TestLogACommand_5() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the next media item in the queue has been loaded"); + } - // - // Tests methods - // + CHIP_ERROR TestLogACommand_6() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the previous media item in the queue has been loaded"); + } - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + CHIP_ERROR TestLogACommand_7() { SetIdentity(kIdentityAlpha); - return WaitForCommissionee(); + return UserPrompt("Verify that the media has skipped forward 10 seconds"); + } + + CHIP_ERROR TestLogACommand_8() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media has skipped backward 10 seconds"); } }; -class Test_TC_MC_3_6 : public TestCommand +class Test_TC_MC_6_3 : public TestCommand { public: - Test_TC_MC_3_6() : TestCommand("Test_TC_MC_3_6"), mTestIndex(0) + Test_TC_MC_6_3() : TestCommand("Test_TC_MC_6_3"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19397,12 +21728,12 @@ class Test_TC_MC_3_6 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_6\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_3\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_6\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_3\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19419,6 +21750,18 @@ class Test_TC_MC_3_6 : public TestCommand 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 : log a command\n"); + err = TestLogACommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : log a command\n"); + err = TestLogACommand_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); + err = TestLogACommand_3(); + break; } if (CHIP_NO_ERROR != err) @@ -19430,7 +21773,7 @@ class Test_TC_MC_3_6 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 4; chip::Optional mCluster; chip::Optional mEndpoint; @@ -19444,12 +21787,30 @@ class Test_TC_MC_3_6 : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(); } + + CHIP_ERROR TestLogACommand_1() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that media is paused"); + } + + CHIP_ERROR TestLogACommand_2() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media has moved to 10 seconds from the starting point."); + } + + CHIP_ERROR TestLogACommand_3() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("User prompt needed to enter the value beyond the furthest valid position"); + } }; -class Test_TC_MC_3_7 : public TestCommand +class Test_TC_MC_6_4 : public TestCommand { public: - Test_TC_MC_3_7() : TestCommand("Test_TC_MC_3_7"), mTestIndex(0) + Test_TC_MC_6_4() : TestCommand("Test_TC_MC_6_4"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19462,12 +21823,12 @@ class Test_TC_MC_3_7 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_7\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_6_4\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_7\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_6_4\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19484,6 +21845,42 @@ class Test_TC_MC_3_7 : public TestCommand 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 : log a command\n"); + err = TestLogACommand_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the PlaybackSpeed attribute from the DUT\n"); + err = TestReadsThePlaybackSpeedAttributeFromTheDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : log a command\n"); + err = TestLogACommand_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the CurrentState attribute\n"); + err = TestReadsTheCurrentStateAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : log a command\n"); + err = TestLogACommand_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : log a command\n"); + err = TestLogACommand_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the CurrentState attribute\n"); + err = TestReadsTheCurrentStateAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : log a command\n"); + err = TestLogACommand_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : log a command\n"); + err = TestLogACommand_9(); + break; } if (CHIP_NO_ERROR != err) @@ -19495,11 +21892,41 @@ class Test_TC_MC_3_7 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 10; chip::Optional mCluster; chip::Optional mEndpoint; + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, float playbackSpeed) + { + (static_cast(context))->OnSuccessResponse_2(playbackSpeed); + } + + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum playbackState) + { + (static_cast(context))->OnSuccessResponse_4(playbackState); + } + + static void OnFailureCallback_7(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, chip::app::Clusters::MediaPlayback::PlaybackStateEnum playbackState) + { + (static_cast(context))->OnSuccessResponse_7(playbackState); + } + // // Tests methods // @@ -19509,12 +21936,108 @@ class Test_TC_MC_3_7 : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(); } + + CHIP_ERROR TestLogACommand_1() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that media is paused"); + } + + CHIP_ERROR TestReadsThePlaybackSpeedAttributeFromTheDut_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaPlaybackClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(float playbackSpeed) + { + VerifyOrReturn(CheckValue("playbackSpeed", playbackSpeed, 0.0f)); + + NextTest(); + } + + CHIP_ERROR TestLogACommand_3() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media is playing"); + } + + CHIP_ERROR TestReadsTheCurrentStateAttribute_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaPlaybackClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(chip::app::Clusters::MediaPlayback::PlaybackStateEnum playbackState) + { + VerifyOrReturn(CheckValue("playbackState", playbackState, 0)); + + NextTest(); + } + + CHIP_ERROR TestLogACommand_5() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media play speed has increased"); + } + + CHIP_ERROR TestLogACommand_6() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media play has reversed direction"); + } + + CHIP_ERROR TestReadsTheCurrentStateAttribute_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::MediaPlaybackClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(chip::app::Clusters::MediaPlayback::PlaybackStateEnum playbackState) + { + VerifyOrReturn(CheckValue("playbackState", playbackState, 0)); + + NextTest(); + } + + CHIP_ERROR TestLogACommand_8() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media play has reversed direction"); + } + + CHIP_ERROR TestLogACommand_9() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Verify that the media is has resumed playing forward at the default speed"); + } }; -class Test_TC_MC_3_8 : public TestCommand +class Test_TC_MC_7_1 : public TestCommand { public: - Test_TC_MC_3_8() : TestCommand("Test_TC_MC_3_8"), mTestIndex(0) + Test_TC_MC_7_1() : TestCommand("Test_TC_MC_7_1"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19527,12 +22050,12 @@ class Test_TC_MC_3_8 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_8\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_8\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19576,10 +22099,10 @@ class Test_TC_MC_3_8 : public TestCommand } }; -class Test_TC_MC_3_9 : public TestCommand +class Test_TC_MC_7_2 : public TestCommand { public: - Test_TC_MC_3_9() : TestCommand("Test_TC_MC_3_9"), mTestIndex(0) + Test_TC_MC_7_2() : TestCommand("Test_TC_MC_7_2"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19592,12 +22115,12 @@ class Test_TC_MC_3_9 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_9\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_7_2\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_9\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_7_2\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19641,10 +22164,10 @@ class Test_TC_MC_3_9 : public TestCommand } }; -class Test_TC_MC_3_10 : public TestCommand +class Test_TC_MC_8_1 : public TestCommand { public: - Test_TC_MC_3_10() : TestCommand("Test_TC_MC_3_10"), mTestIndex(0) + Test_TC_MC_8_1() : TestCommand("Test_TC_MC_8_1"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19657,12 +22180,12 @@ class Test_TC_MC_3_10 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_10\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_8_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_10\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_8_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19679,6 +22202,14 @@ class Test_TC_MC_3_10 : public TestCommand 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 : Reads the CurrentTarget attribute\n"); + err = TestReadsTheCurrentTargetAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the TargetList attribute\n"); + err = TestReadsTheTargetListAttribute_2(); + break; } if (CHIP_NO_ERROR != err) @@ -19690,11 +22221,36 @@ class Test_TC_MC_3_10 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 3; chip::Optional mCluster; chip::Optional mEndpoint; + uint8_t currentTarget; + + static void OnFailureCallback_1(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_1(status); + } + + static void OnSuccessCallback_1(void * context, uint8_t currentNavigatorTarget) + { + (static_cast(context))->OnSuccessResponse_1(currentNavigatorTarget); + } + + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2( + void * context, + const chip::app::DataModel::DecodableList & + targetNavigatorList) + { + (static_cast(context))->OnSuccessResponse_2(targetNavigatorList); + } + // // Tests methods // @@ -19704,12 +22260,54 @@ class Test_TC_MC_3_10 : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(); } + + CHIP_ERROR TestReadsTheCurrentTargetAttribute_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TargetNavigatorClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_1(uint8_t currentNavigatorTarget) + { + VerifyOrReturn(CheckConstraintType("currentNavigatorTarget", "", "uint8")); + currentTarget = currentNavigatorTarget; + NextTest(); + } + + CHIP_ERROR TestReadsTheTargetListAttribute_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TargetNavigatorClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2( + const chip::app::DataModel::DecodableList & + targetNavigatorList) + { + VerifyOrReturn(CheckConstraintType("targetNavigatorList", "", "list")); + NextTest(); + } }; -class Test_TC_MC_3_11 : public TestCommand +class Test_TC_MC_9_1 : public TestCommand { public: - Test_TC_MC_3_11() : TestCommand("Test_TC_MC_3_11"), mTestIndex(0) + Test_TC_MC_9_1() : TestCommand("Test_TC_MC_9_1"), mTestIndex(0) { AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -19722,12 +22320,12 @@ class Test_TC_MC_3_11 : public TestCommand if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_3_11\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_MC_9_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_3_11\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_MC_9_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -19744,6 +22342,34 @@ class Test_TC_MC_3_11 : public TestCommand 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 : Precondition\n"); + err = TestPrecondition_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads the VendorName attribute\n"); + err = TestReadsTheVendorNameAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the VendorID attribute\n"); + err = TestReadsTheVendorIDAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads the ApplicationName attribute\n"); + err = TestReadsTheApplicationNameAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads the ProductID attribute\n"); + err = TestReadsTheProductIDAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Reads the Status attribute\n"); + err = TestReadsTheStatusAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Reads the ApplicationVersion attribute\n"); + err = TestReadsTheApplicationVersionAttribute_7(); + break; } if (CHIP_NO_ERROR != err) @@ -19755,11 +22381,71 @@ class Test_TC_MC_3_11 : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 1; + const uint16_t mTestCount = 8; chip::Optional mCluster; chip::Optional mEndpoint; + static void OnFailureCallback_2(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_2(status); + } + + static void OnSuccessCallback_2(void * context, chip::CharSpan vendorName) + { + (static_cast(context))->OnSuccessResponse_2(vendorName); + } + + static void OnFailureCallback_3(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_3(status); + } + + static void OnSuccessCallback_3(void * context, uint16_t vendorId) + { + (static_cast(context))->OnSuccessResponse_3(vendorId); + } + + static void OnFailureCallback_4(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_4(status); + } + + static void OnSuccessCallback_4(void * context, chip::CharSpan applicationName) + { + (static_cast(context))->OnSuccessResponse_4(applicationName); + } + + static void OnFailureCallback_5(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_5(status); + } + + static void OnSuccessCallback_5(void * context, uint16_t productId) + { + (static_cast(context))->OnSuccessResponse_5(productId); + } + + static void OnFailureCallback_6(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_6(status); + } + + static void OnSuccessCallback_6(void * context, chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum applicationStatus) + { + (static_cast(context))->OnSuccessResponse_6(applicationStatus); + } + + static void OnFailureCallback_7(void * context, EmberAfStatus status) + { + (static_cast(context))->OnFailureResponse_7(status); + } + + static void OnSuccessCallback_7(void * context, chip::CharSpan applicationVersion) + { + (static_cast(context))->OnSuccessResponse_7(applicationVersion); + } + // // Tests methods // @@ -19769,6 +22455,130 @@ class Test_TC_MC_3_11 : public TestCommand SetIdentity(kIdentityAlpha); return WaitForCommissionee(); } + + CHIP_ERROR TestPrecondition_1() + { + SetIdentity(kIdentityAlpha); + return Log("DUT has one or more Content Apps available"); + } + + CHIP_ERROR TestReadsTheVendorNameAttribute_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ApplicationBasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_2(chip::CharSpan vendorName) + { + VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); + NextTest(); + } + + CHIP_ERROR TestReadsTheVendorIDAttribute_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ApplicationBasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_3(uint16_t vendorId) + { + VerifyOrReturn(CheckValue("vendorId", vendorId, 0U)); + + NextTest(); + } + + CHIP_ERROR TestReadsTheApplicationNameAttribute_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ApplicationBasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_4(chip::CharSpan applicationName) + { + VerifyOrReturn(CheckConstraintType("applicationName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("applicationName", applicationName.size(), 256)); + NextTest(); + } + + CHIP_ERROR TestReadsTheProductIDAttribute_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ApplicationBasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_5(uint16_t productId) + { + VerifyOrReturn(CheckConstraintType("productId", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadsTheStatusAttribute_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ApplicationBasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_6(chip::app::Clusters::ApplicationBasic::ApplicationStatusEnum applicationStatus) + { + VerifyOrReturn(CheckValue("applicationStatus", applicationStatus, 0)); + + NextTest(); + } + + CHIP_ERROR TestReadsTheApplicationVersionAttribute_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ApplicationBasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(EmberAfStatus status) { ThrowFailureResponse(); } + + void OnSuccessResponse_7(chip::CharSpan applicationVersion) + { + VerifyOrReturn(CheckConstraintType("applicationVersion", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("applicationVersion", applicationVersion.size(), 32)); + NextTest(); + } }; class Test_TC_OCC_1_1 : public TestCommand @@ -62874,9 +65684,11 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -62890,6 +65702,17 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),