From fba74344e1be109d7c150c893b09b0fb337b5d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=A9gevand?= <77852424+jmeg-sfy@users.noreply.github.com> Date: Thu, 17 Feb 2022 14:45:55 +0100 Subject: [PATCH] WindowCovering: YAML Add GoTos tests (#15193) * Test: Start adding tests backport * TEST: Yaml add WNCV 3.4 3.5 4.3 4.4 * DEV: Remove 2.3 need another PR for it * DEV: Add wait for commissionee * DEV: Remove Darwin tests 3.5 3.4 due to compile issues - Add comment about todos + issues * DEV: Zap all-cluster-app activate missing functions for CI * Restyled by whitespace * Restyled by prettier-yaml * DEV: Activate 3.4 3.5 on Darwin - Issue #15192 is resolved Co-authored-by: Restyled.io --- .../all-clusters-app.matter | 22 + .../all-clusters-common/all-clusters-app.zap | 8 +- examples/chip-tool/templates/tests.js | 4 + src/app/tests/suites/certification/PICS.yaml | 9 + .../certification/Test_TC_WNCV_3_4.yaml | 115 ++ .../certification/Test_TC_WNCV_3_5.yaml | 115 ++ .../certification/Test_TC_WNCV_4_1.yaml | 203 +++ .../certification/Test_TC_WNCV_4_2.yaml | 203 +++ .../certification/Test_TC_WNCV_4_3.yaml | 109 ++ .../certification/Test_TC_WNCV_4_4.yaml | 109 ++ src/darwin/Framework/CHIP/templates/tests.js | 4 + .../Framework/CHIPTests/CHIPClustersTests.m | 660 ++++++++ .../zap-generated/IMClusterCommandHandler.cpp | 36 + .../zap-generated/endpoint_config.h | 48 +- .../chip-tool/zap-generated/test/Commands.h | 1343 +++++++++++++++++ 15 files changed, 2962 insertions(+), 26 deletions(-) create mode 100644 src/app/tests/suites/certification/Test_TC_WNCV_3_4.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WNCV_3_5.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WNCV_4_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WNCV_4_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WNCV_4_3.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WNCV_4_4.yaml diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 607c8d822adadd..c377d2f180d870 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -3512,7 +3512,29 @@ server cluster WindowCovering = 258 { readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; + request struct GoToLiftPercentageRequest { + Percent liftPercentageValue = 0; + Percent100ths liftPercent100thsValue = 1; + } + + request struct GoToLiftValueRequest { + INT16U liftValue = 0; + } + + request struct GoToTiltPercentageRequest { + Percent tiltPercentageValue = 0; + Percent100ths tiltPercent100thsValue = 1; + } + + request struct GoToTiltValueRequest { + INT16U tiltValue = 0; + } + command DownOrClose(): DefaultSuccess = 1; + command GoToLiftPercentage(GoToLiftPercentageRequest): DefaultSuccess = 5; + command GoToLiftValue(GoToLiftValueRequest): DefaultSuccess = 4; + command GoToTiltPercentage(GoToTiltPercentageRequest): DefaultSuccess = 8; + command GoToTiltValue(GoToTiltValueRequest): DefaultSuccess = 7; command StopMotion(): DefaultSuccess = 2; command UpOrOpen(): DefaultSuccess = 0; } diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 6349f15e956b1f..a31014ca72bf1c 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -11587,7 +11587,7 @@ "code": 4, "mfgCode": null, "source": "client", - "incoming": 0, + "incoming": 1, "outgoing": 0 }, { @@ -11595,7 +11595,7 @@ "code": 5, "mfgCode": null, "source": "client", - "incoming": 0, + "incoming": 1, "outgoing": 0 }, { @@ -11603,7 +11603,7 @@ "code": 7, "mfgCode": null, "source": "client", - "incoming": 0, + "incoming": 1, "outgoing": 0 }, { @@ -11611,7 +11611,7 @@ "code": 8, "mfgCode": null, "source": "client", - "incoming": 0, + "incoming": 1, "outgoing": 0 } ], diff --git a/examples/chip-tool/templates/tests.js b/examples/chip-tool/templates/tests.js index f1f2154c0712cc..6db79c1cd13729 100644 --- a/examples/chip-tool/templates/tests.js +++ b/examples/chip-tool/templates/tests.js @@ -229,6 +229,10 @@ function getTests() 'Test_TC_WNCV_3_1', 'Test_TC_WNCV_3_2', 'Test_TC_WNCV_3_3', + 'Test_TC_WNCV_3_4', + 'Test_TC_WNCV_3_5', + 'Test_TC_WNCV_4_3', + 'Test_TC_WNCV_4_4', ]; const TV = [ diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 9707b541a42c11..8b8c0851521552 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -223,6 +223,15 @@ PICS: attribute?" id: A_CURRENTPOSITIONTILTPERCENTAGE + ## WC-Commands received + - label: + "Does the device implement receiving the GoToLiftPercentage command?" + id: PICS_CR_GOTOLIFTPERCENTAGE + + - label: + "Does the device implement receiving the GoToTiltPercentage command?" + id: PICS_CR_GOTOTILTPERCENTAGE + # On/Off Cluster - label: "Does the device implement the OnOff attribute?" id: A_ONOFF diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_3_4.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_3_4.yaml new file mode 100644 index 00000000000000..b356cb05f04476 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WNCV_3_4.yaml @@ -0,0 +1,115 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: + Window Covering [TC-WNCV-3.4] UpOrOpen Long-Run Verification with server as + DUT + +config: + nodeId: 0x12344321 + cluster: "Window Covering" + endpoint: 1 + fastMotionDuration: + type: INT16U + defaultValue: 3000 + fullMotionDuration: + type: INT16U + defaultValue: 6000 + +tests: + - label: "0: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + ################ Position Init Phase ############# + ### Step 1x -> Initialize the Covering position before any testing + ### MANDATORY Init Commands + - label: + "1a: TH sends DownOrClose command to preposition the DUT in the + opposite direction" + command: "DownOrClose" + + ### DUT adjusts to a non-open position + ### Testers should input the fastMotionDuration parameter that match their DUT behavior + - label: + "1b: TH Waits for fastMotionDuration seconds movement(s) on the device" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: fastMotionDuration + + ######## UpOrOpen Long-Run Command ####### + ### Step 2x -> Check UpOrOpen Long-Run effects + ### MANDATORY Command + - label: "2a: TH sends UpOrOpen command to DUT" + command: "UpOrOpen" + + ### DUT move toward its fully-open position + ### Testers should input the fullMotionDuration parameter that match their DUT behavior + - label: + "2b: TH Waits for fullMotionDuration seconds movement(s) on the device" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: fullMotionDuration + + ######## UpOrOpen Long-Run: Category only for Position Aware DUT ####### + ### Step 3x -> Verify the DUT has reached its fully-open limits + ### Mandatory Depends on the FeatureMap + - label: + "3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercent100ths" + PICS: WNCV_LF && WNCV_PA_LF + response: + value: 0 + + ### Optional Depends on the FeatureMap + - label: + "3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional + attribute from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercentage" + PICS: WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE + response: + value: 0 + + ### Mandatory Depends on the FeatureMap + - label: + "3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercent100ths" + PICS: WNCV_TL && WNCV_PA_TL + response: + value: 0 + + ### Optional Depends on the FeatureMap + - label: + "3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional + attribute from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercentage" + PICS: WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONLIFTPERCENTAGE + response: + value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_3_5.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_3_5.yaml new file mode 100644 index 00000000000000..0dbf166c126f93 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WNCV_3_5.yaml @@ -0,0 +1,115 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: + Window Covering [TC-WNCV-3.5] DownOrClose Long-Run Verification with server + as DUT + +config: + nodeId: 0x12344321 + cluster: "Window Covering" + endpoint: 1 + fastMotionDuration: + type: INT16U + defaultValue: 3000 + fullMotionDuration: + type: INT16U + defaultValue: 6000 + +tests: + - label: "0: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + ################ Position Init Phase ############# + ### Step 1x -> Initialize the Covering position before any testing + ### MANDATORY Init Commands + - label: + "1a: TH sends UpOrOpen command to preposition the DUT in the opposite + direction" + command: "UpOrOpen" + + ### DUT adjusts to a non-closed position + ### Testers should input the fastMotionDuration parameter that match their DUT behavior + - label: + "1b: TH Waits for fastMotionDuration seconds movement(s) on the device" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: fastMotionDuration + + ######## DownOrClose Long-Run Command ####### + ### Step 2x -> Check DownOrClose Long-Run effects + ### MANDATORY Command + - label: "2a: TH sends DownOrClose command to DUT" + command: "DownOrClose" + + ### DUT move toward its fully-closed position + ### Testers should input the fullMotionDuration parameter that match their DUT behavior + - label: + "2b: TH Waits for fullMotionDuration seconds movement(s) on the device" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: fullMotionDuration + + ######## DownOrClose Long-Run: Category only for Position Aware DUT ####### + ### Step 3x -> Verify the DUT has reached its fully-open limits + ### Mandatory Depends on the FeatureMap + - label: + "3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercent100ths" + PICS: WNCV_LF && WNCV_PA_LF + response: + value: 10000 + + ### Optional Depends on the FeatureMap + - label: + "3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional + attribute from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercentage" + PICS: WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE + response: + value: 100 + + ### Mandatory Depends on the FeatureMap + - label: + "3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercent100ths" + PICS: WNCV_TL && WNCV_PA_TL + response: + value: 10000 + + ### Optional Depends on the FeatureMap + - label: + "3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional + attribute from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercentage" + PICS: WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONLIFTPERCENTAGE + response: + value: 100 diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_4_1.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_4_1.yaml new file mode 100644 index 00000000000000..49d0385a8682fc --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WNCV_4_1.yaml @@ -0,0 +1,203 @@ +# 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: + Window Covering [TC-WNCV-4.1] GoToLiftPercentage Long-Run Verification with + server as DUT + +# TODO: WindowCovering tests TC-WNCV-4.1 finalize featuremap conditional dependencies + +config: + cluster: "Window Covering" + endpoint: 1 + +tests: + ### Step 1x -> Initialize the Covering position before any testing + ### MANDATORY Init Commands + - label: + "1a: TH sends DownOrClose command to preposition the DUT in the + opposite direction" + command: "DownOrClose" + + - label: "1b: TH Waits for 10 seconds movement(s) on the device" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + ### Depends on the FeatureMap -> Check CurrentPosition attributes + - label: + "1c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercent100ths" + response: + constraints: + notValue: 10000 + + ######## GoToLiftPercentage Long-Run 25 percent ####### + ### Step 2x -> Check GoToLiftPercentage 25% Long-Run effects + - label: "2a: TH sends GoToLiftPercentage command with 25 percent to DUT" + command: "GoToLiftPercentage" + arguments: + values: + - name: "liftPercent100thsValue" + value: 2500 + - name: "liftPercentageValue" + value: 25 + + ### Depends on a sleep/wait command how to do this with a real device for CI keep at 100ms + - label: "2b: DUT updates its attributes" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + ### Mandatory Depends on the FeatureMap + - label: + "2c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "TargetPositionLiftPercent100ths" + response: + value: 2500 + + ### Step 3x -> Verify the DUT has reached its 25% + ### DUT moves toward its 25% position + ### WARNING -> TIMEOUT Cannot be set here yet we while rely on report + ### Timeout might need to be given from the CLI via an extra arguments + - label: "3a: TH set a timeout of 5-10 minutes for failure" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + ### Reports for END OF MOVEMENTs + ### This report check behave like a DO WHILE waiting for the end of the movements + - label: + "3b: Verify DUT reports OperationalStatus attribute to TH after a + GoToLiftPercentage" + command: "subscribeAttribute" + attribute: "OperationalStatus" + minInterval: 10 + maxInterval: 60 + response: + constraints: + type: map8 + value: 0 + + ### Mandatory Depends on the FeatureMap + - label: + "3c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercent100ths" + response: + constraints: + type: uint16 + value: 2500 + + ### Optional Depends on the FeatureMap + - label: + "3d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional + attribute from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercentage" + response: + constraints: + type: uint8 + value: 25 + + ######## GoToLiftPercentage Long-Run for 75.2 percent ####### + ### Step 4x -> Check GoToLiftPercentage 75.20% Long-Run effects + - label: "4a: TH sends GoToLiftPercentage command with 75.20 percent to DUT" + command: "GoToLiftPercentage" + arguments: + values: + - name: "liftPercent100thsValue" + value: 7520 + - name: "liftPercentageValue" + value: 75 + + ### Depends on a sleep/wait command how to do this with a real device for CI keep at 100ms + - label: "4b: DUT updates its attributes" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + ### Mandatory Depends on the FeatureMap + - label: + "4c: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "TargetPositionLiftPercent100ths" + response: + value: 7520 + + ### Step 5x -> Verify the DUT has reached its 75.2% + ### DUT moves toward its 75.2% position + ### WARNING -> TIMEOUT Cannot be set here yet we while rely on report + ### Timeout might need to be given from the CLI via an extra arguments + - label: "5a: TH set a timeout of 5-10 minutes for failure" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + ### Reports for END OF MOVEMENTs + ### This report check behave like a DO WHILE waiting for the end of the movements + - label: + "5b: Verify DUT reports OperationalStatus attribute to TH after a + GoToLiftPercentage" + command: "subscribeAttribute" + attribute: "OperationalStatus" + minInterval: 10 + maxInterval: 60 + response: + constraints: + type: map8 + value: 0 + + ### Mandatory Depends on the FeatureMap + - label: + "5c: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercent100ths" + response: + constraints: + type: uint16 + value: 7520 + + ### Optional Depends on the FeatureMap + - label: + "5d: If (PA & LF) TH reads CurrentPositionLiftPercentage optional + attribute from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercentage" + response: + constraints: + type: uint8 + value: 75 diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_4_2.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_4_2.yaml new file mode 100644 index 00000000000000..430a44f80125a3 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WNCV_4_2.yaml @@ -0,0 +1,203 @@ +# 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: + Window Covering [TC-WNCV-4.2] GoToTiltPercentage Long-Run Verification with + server as DUT + +# TODO: WindowCovering tests TC-WNCV-4.2 finalize featuremap conditional dependencies + +config: + cluster: "Window Covering" + endpoint: 1 + +tests: + ### Step 1x -> Initialize the Covering position before any testing + ### MANDATORY Init Commands + - label: + "1a: TH sends DownOrClose command to preposition the DUT in the + opposite direction" + command: "DownOrClose" + + - label: "1b: TH Waits for 10 seconds movement(s) on the device" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 10000 + + ### Depends on the FeatureMap -> Check CurrentPosition attributes + - label: + "1c: If (PA & LF) TH reads CurrentPositionTiltPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercent100ths" + response: + constraints: + notValue: 10000 + + ######## GoToTiltPercentage Long-Run 30 percent ####### + ### Step 2x -> Check GoToTiltPercentage 30% Long-Run effects + - label: "2a: TH sends GoToTiltPercentage command with 30.00 percent to DUT" + command: "GoToTiltPercentage" + arguments: + values: + - name: "tiltPercent100thsValue" + value: 3000 + - name: "tiltPercentageValue" + value: 30 + + ### Depends on a sleep/wait command how to do this with a real device for CI keep at 100ms + - label: "2b: DUT updates its attributes" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + ### Mandatory Depends on the FeatureMap + - label: + "2c: If (PA & LF) TH reads TargetPositionTiltPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "TargetPositionTiltPercent100ths" + response: + value: 3000 + + ### Step 3x -> Verify the DUT has reached its 30% + ### DUT moves toward its 30% position + ### WARNING -> TIMEOUT Cannot be set here yet we while rely on report + ### Timeout might need to be given from the CLI via an extra arguments + - label: "3a: TH set a timeout of 5-10 minutes for failure" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + ### Reports for END OF MOVEMENTs + ### This report check behave like a DO WHILE waiting for the end of the movements + - label: + "3b: Verify DUT reports OperationalStatus attribute to TH after a + GoToTiltPercentage" + command: "subscribeAttribute" + attribute: "OperationalStatus" + minInterval: 10 + maxInterval: 60 + response: + constraints: + type: map8 + value: 0 + + ### Mandatory Depends on the FeatureMap + - label: + "3c: If (PA & LF) TH reads CurrentPositionTiltPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercent100ths" + response: + constraints: + type: uint16 + value: 3000 + + ### Optional Depends on the FeatureMap + - label: + "3d: If (PA & LF) TH reads CurrentPositionTiltPercentage optional + attribute from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercentage" + response: + constraints: + type: uint8 + value: 30 + + ######## GoToTiltPercentage Long-Run for 60.2 percent ####### + ### Step 4x -> Check GoToTiltPercentage 60.20% Long-Run effects + - label: "4a: TH sends GoToTiltPercentage command with 60.20 percent to DUT" + command: "GoToTiltPercentage" + arguments: + values: + - name: "tiltPercent100thsValue" + value: 6005 + - name: "tiltPercentageValue" + value: 60 + + ### Depends on a sleep/wait command how to do this with a real device for CI keep at 100ms + - label: "4b: DUT updates its attributes" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 100 + + ### Mandatory Depends on the FeatureMap + - label: + "4c: If (PA & LF) TH reads TargetPositionTiltPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "TargetPositionTiltPercent100ths" + response: + value: 6005 + + ### Step 5x -> Verify the DUT has reached its 60.2% + ### DUT moves toward its 60.2% position + ### WARNING -> TIMEOUT Cannot be set here yet we while rely on report + ### Timeout might need to be given from the CLI via an extra arguments + - label: "5a: TH set a timeout of 5-10 minutes for failure" + cluster: "DelayCommands" + command: "WaitForMs" + arguments: + values: + - name: "ms" + value: 1000 + + ### Reports for END OF MOVEMENTs + ### This report check behave like a DO WHILE waiting for the end of the movements + - label: + "5b: Verify DUT reports OperationalStatus attribute to TH after a + GoToTiltPercentage" + command: "subscribeAttribute" + attribute: "OperationalStatus" + minInterval: 10 + maxInterval: 60 + response: + constraints: + type: map8 + value: 0 + + ### Mandatory Depends on the FeatureMap + - label: + "5c: If (PA & LF) TH reads CurrentPositionTiltPercent100ths attribute + from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercent100ths" + response: + constraints: + type: uint16 + value: 6005 + + ### Optional Depends on the FeatureMap + - label: + "5d: If (PA & LF) TH reads CurrentPositionTiltPercentage optional + attribute from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercentage" + response: + constraints: + type: uint8 + value: 60 diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_4_3.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_4_3.yaml new file mode 100644 index 00000000000000..5520094206a847 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WNCV_4_3.yaml @@ -0,0 +1,109 @@ +# 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: + Window Covering [TC-WNCV-4.3] GoToLiftPercentage Limits Verification with + server as DUT + +config: + nodeId: 0x12344321 + cluster: "Window Covering" + endpoint: 1 + +tests: + - label: "0: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + ### CONDITIONAL LIFT Tests from FeatureMap + ######## Check attribute coherence ####### + ### Step 1x -> Verify the Lift Percent100ths and Percent attributes + ### Shall be tested as equals CurrentPositionLiftPercent100ths + - label: + "1a: If (PA_LF & LF) TH reads CurrentPositionLiftPercent100ths from + DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercent100ths" + PICS: WNCV_LF && WNCV_PA_LF + response: + saveAs: attrCurrentPositionLiftPercent100ths + constraints: + minValue: 0 + maxValue: 10000 + + - label: + "1b: If (PA_LF & LF) TH reads CurrentPositionLiftPercentage from DUT" + command: "readAttribute" + attribute: "CurrentPositionLiftPercentage" + PICS: WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE + response: + saveAs: attrCurrentPositionLiftPercentage + constraints: + minValue: 0 + maxValue: 100 + + ##- label: "1c: If (PA_LF & LF) TH assert CurrentPositionLiftPercent100ths/100 equals CurrentPositionLiftPercentage" + ## PICS: WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE + # TODO [TC_WNCV_4_3] WindowCovering Fix this arithmetic operation issue #15190 + + ######## Command BadParams 1 ####### + ### Step 2x -> Verify the GoToLiftPercentage with a BadParam + + # - label: "2a: TH Generate a random badParam" + # since we don't know how to generate a random bad param + # we use a default badParam for this test + + - label: "2b: TH sends GoToLiftPercentage command with BadParam to DUT" + command: "GoToLiftPercentage" + PICS: WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE + arguments: + values: + - name: "LiftPercent100thsValue" + value: 0x3000 + - name: "LiftPercentageValue" + value: 0x3F + response: + error: CONSTRAINT_ERROR + + ######## Command BadParams 2 ###### + ### Step 3x -> Verify the GoToLiftPercentage with 10001 as param + - label: "3a: TH sends GoToLiftPercentage command with 10001 to DUT" + command: "GoToLiftPercentage" + PICS: WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE + arguments: + values: + - name: "LiftPercent100thsValue" + value: 10001 + - name: "LiftPercentageValue" + value: 100 + response: + error: CONSTRAINT_ERROR + + ######## Command BadParams 3 ###### + ### Step 4x -> Verify the GoToLiftPercentage with 0xFFFF as param + - label: "4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT" + command: "GoToLiftPercentage" + PICS: WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE + arguments: + values: + - name: "LiftPercent100thsValue" + value: 0xFFFF + - name: "LiftPercentageValue" + value: 0xFF + response: + error: CONSTRAINT_ERROR diff --git a/src/app/tests/suites/certification/Test_TC_WNCV_4_4.yaml b/src/app/tests/suites/certification/Test_TC_WNCV_4_4.yaml new file mode 100644 index 00000000000000..cf11a0093a52dc --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WNCV_4_4.yaml @@ -0,0 +1,109 @@ +# 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: + Window Covering [TC-WNCV-4.4] GoToTiltPercentage Limits Verification with + server as DUT + +config: + nodeId: 0x12344321 + cluster: "Window Covering" + endpoint: 1 + +tests: + - label: "0: Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + ### CONDITIONAL TILT Tests from FeatureMap + ######## Check attribute coherence ####### + ### Step 1x -> Verify the Tilt Percent100ths and Percent attributes + ### Shall be tested as equals CurrentPositionTiltPercent100ths + - label: + "1a: If (PA_TL & TL) TH reads CurrentPositionTiltPercent100ths from + DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercent100ths" + PICS: WNCV_TL && WNCV_PA_TL + response: + saveAs: attrCurrentPositionTiltPercent100ths + constraints: + minValue: 0 + maxValue: 10000 + + - label: + "1b: If (PA_TL & TL) TH reads CurrentPositionTiltPercentage from DUT" + command: "readAttribute" + attribute: "CurrentPositionTiltPercentage" + PICS: WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE + response: + saveAs: attrCurrentPositionTiltPercentage + constraints: + minValue: 0 + maxValue: 100 + + ##- label: "1c: If (PA_TL & TL) TH assert CurrentPositionTiltPercent100ths/100 equals CurrentPositionTiltPercentage" + ## PICS: WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE + # TODO [TC_WNCV_4_4] WindowCovering Fix this arithmetic operation issue #15190 + + ######## Command BadParams 1 ####### + ### Step 2x -> Verify the GoToTiltPercentage with a BadParam + + # - label: "2a: TH Generate a random badParam" + # since we don't know how to generate a random bad param + # we use a default badParam for this test + + - label: "2b: TH sends GoToTiltPercentage command with BadParam to DUT" + command: "GoToTiltPercentage" + PICS: WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE + arguments: + values: + - name: "TiltPercent100thsValue" + value: 0x3000 + - name: "TiltPercentageValue" + value: 0x3F + response: + error: CONSTRAINT_ERROR + + ######## Command BadParams 2 ###### + ### Step 3x -> Verify the GoToTiltPercentage with 10001 as param + - label: "3a: TH sends GoToTiltPercentage command with 10001 to DUT" + command: "GoToTiltPercentage" + PICS: WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE + arguments: + values: + - name: "TiltPercent100thsValue" + value: 10001 + - name: "TiltPercentageValue" + value: 100 + response: + error: CONSTRAINT_ERROR + + ######## Command BadParams 3 ###### + ### Step 4x -> Verify the GoToTiltPercentage with 0xFFFF as param + - label: "4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT" + command: "GoToTiltPercentage" + PICS: WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE + arguments: + values: + - name: "TiltPercent100thsValue" + value: 0xFFFF + - name: "TiltPercentageValue" + value: 0xFF + response: + error: CONSTRAINT_ERROR diff --git a/src/darwin/Framework/CHIP/templates/tests.js b/src/darwin/Framework/CHIP/templates/tests.js index db2debd1fdbc12..61d5a83d90e555 100644 --- a/src/darwin/Framework/CHIP/templates/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests.js @@ -203,6 +203,10 @@ function getTests() 'Test_TC_WNCV_3_1', 'Test_TC_WNCV_3_2', 'Test_TC_WNCV_3_3', + 'Test_TC_WNCV_3_4', + 'Test_TC_WNCV_3_5', + 'Test_TC_WNCV_4_3', + 'Test_TC_WNCV_4_4', ]; const Others = [ diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 186b905ec4b01b..1d4e332b2d4fce 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -27476,6 +27476,666 @@ - (void)testSendClusterTest_TC_WNCV_3_3_000015_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_WNCV_3_4_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"0: Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_4_000001_DownOrClose +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"1a: TH sends DownOrClose command to preposition the DUT in the opposite direction"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"1a: TH sends DownOrClose command to preposition the DUT in the opposite direction Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_4_000002_WaitForMs +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"1b: TH Waits for fastMotionDuration seconds movement(s) on the device"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_4_000003_UpOrOpen +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"2a: TH sends UpOrOpen command to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster upOrOpenWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"2a: TH sends UpOrOpen command to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_4_000004_WaitForMs +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"2b: TH Waits for fullMotionDuration seconds movement(s) on the device"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 6000); + [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_4_000005_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedShortValue], 0U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_4_000006_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionLiftPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_4_000007_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedShortValue], 0U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_4_000008_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionTiltPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_WNCV_3_5_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"0: Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_5_000001_UpOrOpen +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster upOrOpenWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_5_000002_WaitForMs +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"1b: TH Waits for fastMotionDuration seconds movement(s) on the device"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_5_000003_DownOrClose +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"2a: TH sends DownOrClose command to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster downOrCloseWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"2a: TH sends DownOrClose command to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_5_000004_WaitForMs +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"2b: TH Waits for fullMotionDuration seconds movement(s) on the device"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 6000); + [self waitForExpectationsWithTimeout:(6000 / 1000) + kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_5_000005_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedShortValue], 10000U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_5_000006_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionLiftPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 100); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_5_000007_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedShortValue], 10000U); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_3_5_000008_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionTiltPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 100); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_WNCV_4_3_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"0: Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +NSNumber * _Nullable attrCurrentPositionLiftPercent100ths; +- (void)testSendClusterTest_TC_WNCV_4_3_000001_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"1a: If (PA_LF & LF) TH reads CurrentPositionLiftPercent100ths from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionLiftPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"1a: If (PA_LF & LF) TH reads CurrentPositionLiftPercent100ths from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 10000U); + } + } + { + id actualValue = value; + attrCurrentPositionLiftPercent100ths = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +NSNumber * _Nullable attrCurrentPositionLiftPercentage; +- (void)testSendClusterTest_TC_WNCV_4_3_000002_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"1b: If (PA_LF & LF) TH reads CurrentPositionLiftPercentage from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionLiftPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"1b: If (PA_LF & LF) TH reads CurrentPositionLiftPercentage from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 100); + } + } + { + id actualValue = value; + attrCurrentPositionLiftPercentage = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_4_3_000003_GoToLiftPercentage +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"2b: TH sends GoToLiftPercentage command with BadParam to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPWindowCoveringClusterGoToLiftPercentageParams alloc] init]; + params.liftPercentageValue = [NSNumber numberWithUnsignedChar:63]; + params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:12288U]; + [cluster goToLiftPercentageWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"2b: TH sends GoToLiftPercentage command with BadParam to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_4_3_000004_GoToLiftPercentage +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3a: TH sends GoToLiftPercentage command with 10001 to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPWindowCoveringClusterGoToLiftPercentageParams alloc] init]; + params.liftPercentageValue = [NSNumber numberWithUnsignedChar:100]; + params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:10001U]; + [cluster goToLiftPercentageWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"3a: TH sends GoToLiftPercentage command with 10001 to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_4_3_000005_GoToLiftPercentage +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPWindowCoveringClusterGoToLiftPercentageParams alloc] init]; + params.liftPercentageValue = [NSNumber numberWithUnsignedChar:255]; + params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:65535U]; + [cluster goToLiftPercentageWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_WNCV_4_4_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"0: Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +NSNumber * _Nullable attrCurrentPositionTiltPercent100ths; +- (void)testSendClusterTest_TC_WNCV_4_4_000001_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"1a: If (PA_TL & TL) TH reads CurrentPositionTiltPercent100ths from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionTiltPercent100thsWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"1a: If (PA_TL & TL) TH reads CurrentPositionTiltPercent100ths from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 10000U); + } + } + { + id actualValue = value; + attrCurrentPositionTiltPercent100ths = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +NSNumber * _Nullable attrCurrentPositionTiltPercentage; +- (void)testSendClusterTest_TC_WNCV_4_4_000002_ReadAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"1b: If (PA_TL & TL) TH reads CurrentPositionTiltPercentage from DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster + readAttributeCurrentPositionTiltPercentageWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"1b: If (PA_TL & TL) TH reads CurrentPositionTiltPercentage from DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 100); + } + } + { + id actualValue = value; + attrCurrentPositionTiltPercentage = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_4_4_000003_GoToTiltPercentage +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"2b: TH sends GoToTiltPercentage command with BadParam to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPWindowCoveringClusterGoToTiltPercentageParams alloc] init]; + params.tiltPercentageValue = [NSNumber numberWithUnsignedChar:63]; + params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:12288U]; + [cluster goToTiltPercentageWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"2b: TH sends GoToTiltPercentage command with BadParam to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_4_4_000004_GoToTiltPercentage +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"3a: TH sends GoToTiltPercentage command with 10001 to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPWindowCoveringClusterGoToTiltPercentageParams alloc] init]; + params.tiltPercentageValue = [NSNumber numberWithUnsignedChar:100]; + params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:10001U]; + [cluster goToTiltPercentageWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"3a: TH sends GoToTiltPercentage command with 10001 to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WNCV_4_4_000005_GoToTiltPercentage +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWindowCovering * cluster = [[CHIPTestWindowCovering alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + __auto_type * params = [[CHIPWindowCoveringClusterGoToTiltPercentageParams alloc] init]; + params.tiltPercentageValue = [NSNumber numberWithUnsignedChar:255]; + params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:65535U]; + [cluster goToTiltPercentageWithParams:params + completionHandler:^(NSError * _Nullable err) { + NSLog(@"4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + - (void)testSendClusterTestCluster_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; diff --git a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp index 4cf492b693448d..c9e09b324529e0 100644 --- a/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp @@ -1766,6 +1766,42 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } break; } + case Commands::GoToLiftPercentage::Id: { + Commands::GoToLiftPercentage::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfWindowCoveringClusterGoToLiftPercentageCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::GoToLiftValue::Id: { + Commands::GoToLiftValue::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfWindowCoveringClusterGoToLiftValueCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::GoToTiltPercentage::Id: { + Commands::GoToTiltPercentage::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfWindowCoveringClusterGoToTiltPercentageCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + case Commands::GoToTiltValue::Id: { + Commands::GoToTiltValue::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfWindowCoveringClusterGoToTiltValueCallback(apCommandObj, aCommandPath, commandData); + } + break; + } case Commands::StopMotion::Id: { Commands::StopMotion::DecodableType commandData; TLVError = DataModel::Decode(aDataTlv, commandData); diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 0f359da7605404..1fc635574a3f2e 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -2682,6 +2682,10 @@ 0x00000000 /* UpOrOpen */, \ 0x00000001 /* DownOrClose */, \ 0x00000002 /* StopMotion */, \ + 0x00000004 /* GoToLiftValue */, \ + 0x00000005 /* GoToLiftPercentage */, \ + 0x00000007 /* GoToTiltValue */, \ + 0x00000008 /* GoToTiltPercentage */, \ chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 1, Cluster: Barrier Control (server) */\ /* client_generated */ \ @@ -3349,7 +3353,7 @@ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 146 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 150 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3371,7 +3375,7 @@ .clusterSize = 34, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayThermostatServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 149 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 153 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3393,7 +3397,7 @@ .clusterSize = 341, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 153 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 157 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3470,8 +3474,8 @@ .clusterSize = 16, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(MESSAGE_SENT_FUNCTION), \ .functions = chipFuncArrayIasZoneServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 173 ) ,\ - .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 175 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 177 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 179 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ @@ -3492,7 +3496,7 @@ .clusterSize = 256, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 178 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 182 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3503,7 +3507,7 @@ .clusterSize = 257, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 181 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 185 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3514,7 +3518,7 @@ .clusterSize = 39, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 183 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 187 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3525,7 +3529,7 @@ .clusterSize = 257, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 187 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 191 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3536,7 +3540,7 @@ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 192 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 196 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3547,7 +3551,7 @@ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 194 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 198 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3558,7 +3562,7 @@ .clusterSize = 260, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 196 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 200 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3569,7 +3573,7 @@ .clusterSize = 257, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 199 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 203 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3580,7 +3584,7 @@ .clusterSize = 256, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 202 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 206 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3602,7 +3606,7 @@ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 204 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 208 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3613,8 +3617,8 @@ .clusterSize = 3285, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 206 ) ,\ - .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 225 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 210 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 229 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ @@ -3635,8 +3639,8 @@ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 234 ) ,\ - .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 241 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 238 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 245 ) ,\ },\ { \ /* Endpoint: 2, Cluster: On/Off (server) */ \ @@ -3646,7 +3650,7 @@ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 246 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 250 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ @@ -3679,8 +3683,8 @@ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 250 ) ,\ - .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 257 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 254 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 261 ) ,\ },\ } diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index bc445feeeaa7f7..4f832fc7ab9850 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -142,6 +142,10 @@ class TestList : public Command printf("Test_TC_WNCV_3_1\n"); printf("Test_TC_WNCV_3_2\n"); printf("Test_TC_WNCV_3_3\n"); + printf("Test_TC_WNCV_3_4\n"); + printf("Test_TC_WNCV_3_5\n"); + printf("Test_TC_WNCV_4_3\n"); + printf("Test_TC_WNCV_4_4\n"); printf("TV_TargetNavigatorCluster\n"); printf("TV_AudioOutputCluster\n"); printf("TV_ApplicationLauncherCluster\n"); @@ -50385,6 +50389,1341 @@ class Test_TC_WNCV_3_3 : public TestCommand } }; +class Test_TC_WNCV_3_4 : public TestCommand +{ +public: + Test_TC_WNCV_3_4(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WNCV_3_4", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("fastMotionDuration", 0, UINT16_MAX, &mFastMotionDuration); + AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); + } + + ~Test_TC_WNCV_3_4() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_3_4\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_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 : 0: Wait for the commissioned device to be retrieved\n"); + err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress( + chipTool, + " ***** Test Step 1 : 1a: TH sends DownOrClose command to preposition the DUT in the opposite direction\n"); + err = Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1(); + break; + case 2: + ChipLogProgress(chipTool, + " ***** Test Step 2 : 1b: TH Waits for fastMotionDuration seconds movement(s) on the device\n"); + err = Test1bThWaitsForFastMotionDurationSecondsMovementsOnTheDevice_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : 2a: TH sends UpOrOpen command to DUT\n"); + err = Test2aThSendsUpOrOpenCommandToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, + " ***** Test Step 4 : 2b: TH Waits for fullMotionDuration seconds movement(s) on the device\n"); + err = Test2bThWaitsForFullMotionDurationSecondsMovementsOnTheDevice_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : 3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) + { + NextTest(); + return; + } + err = Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_5(); + break; + case 6: + ChipLogProgress( + chipTool, + " ***** Test Step 6 : 3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test3bIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : 3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) + { + NextTest(); + return; + } + err = Test3cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_7(); + break; + case 8: + ChipLogProgress( + chipTool, + " ***** Test Step 8 : 3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONLIFTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test3dIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_8(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 9; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mFastMotionDuration; + chip::Optional mFullMotionDuration; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + static void OnFailureCallback_5(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_5(error); + } + + static void OnSuccessCallback_5(void * context, + const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) + { + (static_cast(context))->OnSuccessResponse_5(currentPositionLiftPercent100ths); + } + + static void OnFailureCallback_6(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_6(error); + } + + static void OnSuccessCallback_6(void * context, + const chip::app::DataModel::Nullable & currentPositionLiftPercentage) + { + (static_cast(context))->OnSuccessResponse_6(currentPositionLiftPercentage); + } + + static void OnFailureCallback_7(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_7(error); + } + + static void OnSuccessCallback_7(void * context, + const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) + { + (static_cast(context))->OnSuccessResponse_7(currentPositionTiltPercent100ths); + } + + static void OnFailureCallback_8(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_8(error); + } + + static void OnSuccessCallback_8(void * context, + const chip::app::DataModel::Nullable & currentPositionTiltPercentage) + { + (static_cast(context))->OnSuccessResponse_8(currentPositionTiltPercentage); + } + + // + // Tests methods + // + + CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR Test1aThSendsDownOrCloseCommandToPrepositionTheDutInTheOppositeDirection_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; + + ListFreer listFreer; + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_1(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR Test1bThWaitsForFastMotionDurationSecondsMovementsOnTheDevice_2() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(mFastMotionDuration.HasValue() ? mFastMotionDuration.Value() : 3000U); + } + + CHIP_ERROR Test2aThSendsUpOrOpenCommandToDut_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type; + + ListFreer listFreer; + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_3(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_3(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR Test2bThWaitsForFullMotionDurationSecondsMovementsOnTheDevice_4() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + + CHIP_ERROR Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_5(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) + { + VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths)); + VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", currentPositionLiftPercent100ths.Value(), 0U)); + + NextTest(); + } + + CHIP_ERROR Test3bIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_6(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) + { + VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercentage", currentPositionLiftPercentage)); + VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", currentPositionLiftPercentage.Value(), 0)); + + NextTest(); + } + + CHIP_ERROR Test3cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_7(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) + { + VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths)); + VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", currentPositionTiltPercent100ths.Value(), 0U)); + + NextTest(); + } + + CHIP_ERROR Test3dIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_8(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) + { + VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercentage", currentPositionTiltPercentage)); + VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", currentPositionTiltPercentage.Value(), 0)); + + NextTest(); + } +}; + +class Test_TC_WNCV_3_5 : public TestCommand +{ +public: + Test_TC_WNCV_3_5(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WNCV_3_5", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("fastMotionDuration", 0, UINT16_MAX, &mFastMotionDuration); + AddArgument("fullMotionDuration", 0, UINT16_MAX, &mFullMotionDuration); + } + + ~Test_TC_WNCV_3_5() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_3_5\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_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 : 0: Wait for the commissioned device to be retrieved\n"); + err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress( + chipTool, " ***** Test Step 1 : 1a: TH sends UpOrOpen command to preposition the DUT in the opposite direction\n"); + err = Test1aThSendsUpOrOpenCommandToPrepositionTheDutInTheOppositeDirection_1(); + break; + case 2: + ChipLogProgress(chipTool, + " ***** Test Step 2 : 1b: TH Waits for fastMotionDuration seconds movement(s) on the device\n"); + err = Test1bThWaitsForFastMotionDurationSecondsMovementsOnTheDevice_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : 2a: TH sends DownOrClose command to DUT\n"); + err = Test2aThSendsDownOrCloseCommandToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, + " ***** Test Step 4 : 2b: TH Waits for fullMotionDuration seconds movement(s) on the device\n"); + err = Test2bThWaitsForFullMotionDurationSecondsMovementsOnTheDevice_4(); + break; + case 5: + ChipLogProgress(chipTool, + " ***** Test Step 5 : 3a: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute from DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) + { + NextTest(); + return; + } + err = Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_5(); + break; + case 6: + ChipLogProgress( + chipTool, + " ***** Test Step 6 : 3b: If (PA & LF) TH reads CurrentPositionLiftPercentage optional attribute from DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test3bIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : 3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute from DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) + { + NextTest(); + return; + } + err = Test3cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_7(); + break; + case 8: + ChipLogProgress( + chipTool, + " ***** Test Step 8 : 3d: If (PA & TL) TH reads CurrentPositionTiltPercentage optional attribute from DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONLIFTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test3dIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_8(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 9; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mFastMotionDuration; + chip::Optional mFullMotionDuration; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + static void OnFailureCallback_5(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_5(error); + } + + static void OnSuccessCallback_5(void * context, + const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) + { + (static_cast(context))->OnSuccessResponse_5(currentPositionLiftPercent100ths); + } + + static void OnFailureCallback_6(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_6(error); + } + + static void OnSuccessCallback_6(void * context, + const chip::app::DataModel::Nullable & currentPositionLiftPercentage) + { + (static_cast(context))->OnSuccessResponse_6(currentPositionLiftPercentage); + } + + static void OnFailureCallback_7(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_7(error); + } + + static void OnSuccessCallback_7(void * context, + const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) + { + (static_cast(context))->OnSuccessResponse_7(currentPositionTiltPercent100ths); + } + + static void OnFailureCallback_8(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_8(error); + } + + static void OnSuccessCallback_8(void * context, + const chip::app::DataModel::Nullable & currentPositionTiltPercentage) + { + (static_cast(context))->OnSuccessResponse_8(currentPositionTiltPercentage); + } + + // + // Tests methods + // + + CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR Test1aThSendsUpOrOpenCommandToPrepositionTheDutInTheOppositeDirection_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Type; + + ListFreer listFreer; + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_1(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_1(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_1() { NextTest(); } + + CHIP_ERROR Test1bThWaitsForFastMotionDurationSecondsMovementsOnTheDevice_2() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(mFastMotionDuration.HasValue() ? mFastMotionDuration.Value() : 3000U); + } + + CHIP_ERROR Test2aThSendsDownOrCloseCommandToDut_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Type; + + ListFreer listFreer; + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_3(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_3(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR Test2bThWaitsForFullMotionDurationSecondsMovementsOnTheDevice_4() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(mFullMotionDuration.HasValue() ? mFullMotionDuration.Value() : 6000U); + } + + CHIP_ERROR Test3aIfPaLfThReadsCurrentPositionLiftPercent100thsAttributeFromDut_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_5(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) + { + VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths)); + VerifyOrReturn(CheckValue("currentPositionLiftPercent100ths.Value()", currentPositionLiftPercent100ths.Value(), 10000U)); + + NextTest(); + } + + CHIP_ERROR Test3bIfPaLfThReadsCurrentPositionLiftPercentageOptionalAttributeFromDut_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_6(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) + { + VerifyOrReturn(CheckValueNonNull("currentPositionLiftPercentage", currentPositionLiftPercentage)); + VerifyOrReturn(CheckValue("currentPositionLiftPercentage.Value()", currentPositionLiftPercentage.Value(), 100)); + + NextTest(); + } + + CHIP_ERROR Test3cIfPaTlThReadsCurrentPositionTiltPercent100thsAttributeFromDut_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_7(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) + { + VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths)); + VerifyOrReturn(CheckValue("currentPositionTiltPercent100ths.Value()", currentPositionTiltPercent100ths.Value(), 10000U)); + + NextTest(); + } + + CHIP_ERROR Test3dIfPaTlThReadsCurrentPositionTiltPercentageOptionalAttributeFromDut_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_8(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) + { + VerifyOrReturn(CheckValueNonNull("currentPositionTiltPercentage", currentPositionTiltPercentage)); + VerifyOrReturn(CheckValue("currentPositionTiltPercentage.Value()", currentPositionTiltPercentage.Value(), 100)); + + NextTest(); + } +}; + +class Test_TC_WNCV_4_3 : public TestCommand +{ +public: + Test_TC_WNCV_4_3(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WNCV_4_3", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_WNCV_4_3() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_4_3\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_4_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 : 0: Wait for the commissioned device to be retrieved\n"); + err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : 1a: If (PA_LF & LF) TH reads CurrentPositionLiftPercent100ths from DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF")) + { + NextTest(); + return; + } + err = Test1aIfPaLfLfThReadsCurrentPositionLiftPercent100thsFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: If (PA_LF & LF) TH reads CurrentPositionLiftPercentage from DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF && A_CURRENTPOSITIONLIFTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test1bIfPaLfLfThReadsCurrentPositionLiftPercentageFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : 2b: TH sends GoToLiftPercentage command with BadParam to DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test2bThSendsGoToLiftPercentageCommandWithBadParamToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : 3a: TH sends GoToLiftPercentage command with 10001 to DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test3aThSendsGoToLiftPercentageCommandWith10001ToDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : 4a: TH sends GoToLiftPercentage command with 0xFFFF to DUT\n"); + if (ShouldSkip("WNCV_LF && WNCV_PA_LF || WNCV_LF && PICS_CR_GOTOLIFTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test4aThSendsGoToLiftPercentageCommandWith0xFFFFToDut_5(); + 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 = 6; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + + chip::app::DataModel::Nullable attrCurrentPositionLiftPercent100ths; + chip::app::DataModel::Nullable attrCurrentPositionLiftPercentage; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + static void OnFailureCallback_1(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_1(error); + } + + static void OnSuccessCallback_1(void * context, + const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) + { + (static_cast(context))->OnSuccessResponse_1(currentPositionLiftPercent100ths); + } + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2(void * context, + const chip::app::DataModel::Nullable & currentPositionLiftPercentage) + { + (static_cast(context))->OnSuccessResponse_2(currentPositionLiftPercentage); + } + + // + // Tests methods + // + + CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR Test1aIfPaLfLfThReadsCurrentPositionLiftPercent100thsFromDut_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_1(const chip::app::DataModel::Nullable & currentPositionLiftPercent100ths) + { + VerifyOrReturn( + CheckConstraintMinValue("currentPositionLiftPercent100ths", currentPositionLiftPercent100ths, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercent100ths", + currentPositionLiftPercent100ths, 10000U)); + attrCurrentPositionLiftPercent100ths = currentPositionLiftPercent100ths; + NextTest(); + } + + CHIP_ERROR Test1bIfPaLfLfThReadsCurrentPositionLiftPercentageFromDut_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2(const chip::app::DataModel::Nullable & currentPositionLiftPercentage) + { + VerifyOrReturn(CheckConstraintMinValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 0)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionLiftPercentage", currentPositionLiftPercentage, 100)); + attrCurrentPositionLiftPercentage = currentPositionLiftPercentage; + NextTest(); + } + + CHIP_ERROR Test2bThSendsGoToLiftPercentageCommandWithBadParamToDut_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; + + ListFreer listFreer; + RequestType request; + request.liftPercentageValue = 63; + request.liftPercent100thsValue = 12288U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_3(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_3(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_3() { ThrowSuccessResponse(); } + + CHIP_ERROR Test3aThSendsGoToLiftPercentageCommandWith10001ToDut_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; + + ListFreer listFreer; + RequestType request; + request.liftPercentageValue = 100; + request.liftPercent100thsValue = 10001U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_4(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_4() { ThrowSuccessResponse(); } + + CHIP_ERROR Test4aThSendsGoToLiftPercentageCommandWith0xFFFFToDut_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type; + + ListFreer listFreer; + RequestType request; + request.liftPercentageValue = 255; + request.liftPercent100thsValue = 65535U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_5(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_5(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_5() { ThrowSuccessResponse(); } +}; + +class Test_TC_WNCV_4_4 : public TestCommand +{ +public: + Test_TC_WNCV_4_4(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WNCV_4_4", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + } + + ~Test_TC_WNCV_4_4() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WNCV_4_4\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WNCV_4_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 : 0: Wait for the commissioned device to be retrieved\n"); + err = Test0WaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, + " ***** Test Step 1 : 1a: If (PA_TL & TL) TH reads CurrentPositionTiltPercent100ths from DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL")) + { + NextTest(); + return; + } + err = Test1aIfPaTlTlThReadsCurrentPositionTiltPercent100thsFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : 1b: If (PA_TL & TL) TH reads CurrentPositionTiltPercentage from DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL && A_CURRENTPOSITIONTILTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test1bIfPaTlTlThReadsCurrentPositionTiltPercentageFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : 2b: TH sends GoToTiltPercentage command with BadParam to DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test2bThSendsGoToTiltPercentageCommandWithBadParamToDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : 3a: TH sends GoToTiltPercentage command with 10001 to DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test3aThSendsGoToTiltPercentageCommandWith10001ToDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : 4a: TH sends GoToTiltPercentage command with 0xFFFF to DUT\n"); + if (ShouldSkip("WNCV_TL && WNCV_PA_TL || WNCV_TL && PICS_CR_GOTOTILTPERCENTAGE")) + { + NextTest(); + return; + } + err = Test4aThSendsGoToTiltPercentageCommandWith0xFFFFToDut_5(); + 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 = 6; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + + chip::app::DataModel::Nullable attrCurrentPositionTiltPercent100ths; + chip::app::DataModel::Nullable attrCurrentPositionTiltPercentage; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & nodeData) override + { + bool isExpectedDnssdResult = false; + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + static void OnFailureCallback_1(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_1(error); + } + + static void OnSuccessCallback_1(void * context, + const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) + { + (static_cast(context))->OnSuccessResponse_1(currentPositionTiltPercent100ths); + } + + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2(void * context, + const chip::app::DataModel::Nullable & currentPositionTiltPercentage) + { + (static_cast(context))->OnSuccessResponse_2(currentPositionTiltPercentage); + } + + // + // Tests methods + // + + CHIP_ERROR Test0WaitForTheCommissionedDeviceToBeRetrieved_0() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR Test1aIfPaTlTlThReadsCurrentPositionTiltPercent100thsFromDut_1() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_1(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_1(const chip::app::DataModel::Nullable & currentPositionTiltPercent100ths) + { + VerifyOrReturn( + CheckConstraintMinValue("currentPositionTiltPercent100ths", currentPositionTiltPercent100ths, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercent100ths", + currentPositionTiltPercent100ths, 10000U)); + attrCurrentPositionTiltPercent100ths = currentPositionTiltPercent100ths; + NextTest(); + } + + CHIP_ERROR Test1bIfPaTlTlThReadsCurrentPositionTiltPercentageFromDut_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::WindowCoveringClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ListFreer listFreer; + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2(const chip::app::DataModel::Nullable & currentPositionTiltPercentage) + { + VerifyOrReturn(CheckConstraintMinValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 0)); + VerifyOrReturn(CheckConstraintMaxValue("currentPositionTiltPercentage", currentPositionTiltPercentage, 100)); + attrCurrentPositionTiltPercentage = currentPositionTiltPercentage; + NextTest(); + } + + CHIP_ERROR Test2bThSendsGoToTiltPercentageCommandWithBadParamToDut_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; + + ListFreer listFreer; + RequestType request; + request.tiltPercentageValue = 63; + request.tiltPercent100thsValue = 12288U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_3(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_3(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_3() { ThrowSuccessResponse(); } + + CHIP_ERROR Test3aThSendsGoToTiltPercentageCommandWith10001ToDut_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; + + ListFreer listFreer; + RequestType request; + request.tiltPercentageValue = 100; + request.tiltPercent100thsValue = 10001U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_4(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_4(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_4() { ThrowSuccessResponse(); } + + CHIP_ERROR Test4aThSendsGoToTiltPercentageCommandWith0xFFFFToDut_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type; + + ListFreer listFreer; + RequestType request; + request.tiltPercentageValue = 255; + request.tiltPercent100thsValue = 65535U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_5(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_5(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_5() { ThrowSuccessResponse(); } +}; + class TV_TargetNavigatorCluster : public TestCommand { public: @@ -95882,6 +97221,10 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig),