From 530349abc047f3d911216eac94c733bd6de4604d Mon Sep 17 00:00:00 2001 From: weicheng Date: Fri, 9 Jun 2023 11:16:41 +0800 Subject: [PATCH 1/6] [ASR] add asr getting stated guide; add ASR582X CI (#27057) * [ASR] add asr getting stated guide; add ASR582X CI * remove unused env in CI; remove app list --------- Co-authored-by: Andrei Litvin --- .github/workflows/examples-asr.yaml | 70 +++++++++ docs/guides/README.md | 1 + docs/guides/asr_getting_started_guide.md | 134 ++++++++++++++++++ docs/guides/index.md | 1 + examples/lighting-app/asr/README.md | 84 ++++------- examples/platform/asr/shell/matter_shell.cpp | 3 + scripts/build/build/targets.py | 2 + scripts/build/builders/asr.py | 5 + .../build/testdata/all_targets_linux_x64.txt | 2 +- src/platform/ASR/ASRConfig.h | 2 - src/platform/ASR/ASROTAImageProcessor.cpp | 4 +- src/platform/ASR/ASRUtils.cpp | 3 - src/platform/ASR/ConnectivityManagerImpl.cpp | 3 +- src/platform/ASR/KeyValueStoreManagerImpl.cpp | 2 +- .../ASR/NetworkCommissioningWiFiDriver.cpp | 7 +- src/platform/ASR/PlatformManagerImpl.h | 2 + src/platform/ASR/args.gni | 2 + 17 files changed, 252 insertions(+), 75 deletions(-) create mode 100644 .github/workflows/examples-asr.yaml create mode 100644 docs/guides/asr_getting_started_guide.md diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml new file mode 100644 index 00000000000000..08dc3095ca5d7e --- /dev/null +++ b/.github/workflows/examples-asr.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Build example - ASR + +on: + push: + pull_request: + merge_group: + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} + cancel-in-progress: true + +env: + CHIP_NO_LOG_TIMESTAMPS: true + # XXX: Workaround for https://github.com/actions/cache/issues/1141 + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3 + +jobs: + asr: + name: ASR + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: connectedhomeip/chip-build-asr:0.7.14 + options: --user root + + steps: + - uses: Wandalen/wretry.action@v1.0.36 + name: Checkout + with: + action: actions/checkout@v3 + with: | + token: ${{ github.token }} + attempt_limit: 3 + attempt_delay: 2000 + - name: Checkout submodules + run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform asr + - name: Bootstrap cache + uses: actions/cache@v3 + timeout-minutes: 10 + with: + key: ${{ runner.os }}-env-${{ hashFiles('scripts/setup/*', 'third_party/pigweed/**') }} + path: | + .environment + build_overrides/pigweed_environment.gni + - name: Bootstrap + run: bash scripts/bootstrap.sh + - name: Build all ASR582X examples + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py \ + --target asr-asr582x-lighting \ + --target asr-asr582x-lighting-ota \ + build \ + " \ No newline at end of file diff --git a/docs/guides/README.md b/docs/guides/README.md index 451a2c6d2fdff7..d37c959e3a602c 100644 --- a/docs/guides/README.md +++ b/docs/guides/README.md @@ -4,6 +4,7 @@ - [Android - Building](./android_building.md) - [Apple - Testing with iPhone, iPad, macOS, Apple TV, HomePod, Watch, etc](./darwin.md) +- [ASR - Getting Started Guide](./asr_getting_started_guide.md) - [Espressif (ESP32) - Getting Started Guide](./esp32/README.md) - [Infineon PSoC6 - Software Update](./infineon_psoc6_software_update.md) - [Linux - Simulated Devices](./simulated_device_linux.md) diff --git a/docs/guides/asr_getting_started_guide.md b/docs/guides/asr_getting_started_guide.md new file mode 100644 index 00000000000000..fa86dfda279328 --- /dev/null +++ b/docs/guides/asr_getting_started_guide.md @@ -0,0 +1,134 @@ +# ASR Getting Started Guide + +The ASR platform is a [Matter](https://github.com/project-chip/connectedhomeip) +platform that uses ASR FreeRTOS SDK. + +--- + +- [ASR Getting Started Guide](#asr-getting-started-guide) + - [Supported Chips](#supported-chips) + - [Matter Example Applications](#matter-example-applications) + - [Building the Example Application](#building-the-example-application) + - [Commissioning](#commissioning) + - [BLE mode](#ble-mode) + - [IP mode](#ip-mode) + - [Shell](#shell) + - [OTA](#ota) + +--- + +## Supported Chips + +The ASR platform is supported on: + +- [ASR582X](http://www.asrmicro.com/en/goods/proinfo/36.html) +- [ASR595X](http://www.asrmicro.com/en/goods/proinfo/42.html) + +## Matter Example Applications + +Sample Matter applications are provided for the ASR platform. They can be used +to speed up development. You can find them in the samples with `/asr` subfolder. + +## Building the Example Application + +- [Setup Matter Environment](./BUILDING.md) + +- Setup toolchain + - for ASR582X + ``` + cd toolchain + wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + tar -jxvf gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 + export ASR_TOOLCHAIN_PATH={abs-path-to-toolchain}/gcc-arm-none-eabi-9-2019-q4-major/bin/ + ``` + - for ASR595X + ``` + git clone --depth=1 https://github.com/asriot/Tools.git + cd Tools/toolchain + cat asr_riscv_gnu_toolchain_10.2_ubuntu-16.04.tar.bz2.part* > asr_riscv_gnu_toolchain_10.2_ubuntu-16.04.tar.bz2 + mkdir -p asr_riscv_gnu_toolchain_10.2_ubuntu-16.04 + tar -jxvf asr_riscv_gnu_toolchain_10.2_ubuntu-16.04.tar.bz2 -C asr_riscv_gnu_toolchain_10.2_ubuntu-16.04/ + export ASR_TOOLCHAIN_PATH={abs-path-to-toolchain}/asr_riscv_gnu_toolchain_10.2_ubuntu-16.04/bin/ + ``` +- Setup Chip environment + - for ASR582X: + ``` + export ASR_BOARD=asr582x + ``` + - for ASR595X: + ``` + export ASR_BOARD=asr595x + ``` +- Building the Application + + If the lighting example is to be built: + + ``` + ./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting build + ``` + +- The output image files are stored in the subdirectories under `out`, the + subdirectory name is the same as the argument specified after the option + `--target` when build the examples. + +- After building the application, `DOGO` tool is used to flash it to the + board. + +## Commissioning + +There are two commissioning modes supported by ASR platform: + +### BLE mode + +1. Build and Flash +2. The example will run automatically after booting the ASR board. +3. Restore factory settings using command `recovery` +4. Commissioning with + [Chip-Tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool),for + example: + ``` + ./chip-tool pairing ble-wifi + ``` + +### IP mode + +1. Build and Flash +2. The example will run automatically after booting the ASR board. +3. Restore factory settings using command `recovery` +4. Connect to AP using command `wifi_open sta [ssid] [password]` +5. Commissioning with + [Chip-Tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool),for + example: + ``` + ./chip-tool pairing onnetwork-long + ``` + +## Shell + +1. To build the example with Matter shell, exactly the same steps as above but + add argument `-shell` when using the `build_examples.py` script. For example: + `./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting-shell build` +2. The example will run automatically after booting the ASR board. +3. Use `help` command to list all supported commands: + ``` + help + base64 Base64 encode / decode utilities + exit Exit the shell application + help List out all top level commands + version Output the software version + ble BLE transport commands + wifi Usage: wifi + config Manage device configuration. Usage to dump value: config [param_name] and to set some values (discriminator): config [param_name] [param_value]. + device Device management commands + onboardingcodes Dump device onboarding codes. Usage: onboardingcodes none|softap|ble|onnetwork [qrcode|qrcodeurl|manualpairingcode] + dns Dns client commands + OnOff OnOff commands. Usage: OnOff [on|off] + Done + ``` + +## OTA + +To build the example with the Matter OTA Requestor functionality, exactly the +same steps as above but add argument `-ota` when using the `build_examples.py` +script. For example: +`./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting-ota build` diff --git a/docs/guides/index.md b/docs/guides/index.md index 5d93bbb9b012ae..1cbfcabcf17c61 100644 --- a/docs/guides/index.md +++ b/docs/guides/index.md @@ -20,6 +20,7 @@ esp32/README - [Android - Building](./android_building.md) - [Apple - Testing with iPhone, iPad, macOS, Apple TV, HomePod, Watch, etc](./darwin.md) +- [ASR - Getting Started Guide](./asr_getting_started_guide.md) - [Espressif (ESP32) - Getting Started Guide](./esp32/README.md) - [Infineon PSoC6 - Software Update](./infineon_psoc6_software_update.md) - [Linux - Simulated Devices](./simulated_device_linux.md) diff --git a/examples/lighting-app/asr/README.md b/examples/lighting-app/asr/README.md index 78755f02f9119a..c9b8009b8a35f1 100755 --- a/examples/lighting-app/asr/README.md +++ b/examples/lighting-app/asr/README.md @@ -1,80 +1,33 @@ -# CHIP ASR Lighting Example +# Matter ASR Lighting Example This example demonstrates the Matter Lighting application on ASR platform. --- -- [CHIP ASR Lighting Example](#chip-asr-lighting-example) +- [Matter ASR Lighting Example](#matter-asr-lighting-example) - [Supported Chips](#supported-chips) - - [Building the Example Application](#building-the-example-application) - - [Commissioning](#commissioning) - - [BLE mode](#ble-mode) - - [IP mode](#ip-mode) + - [Building and Commissioning](#building-and-commissioning) - [Cluster Control](#cluster-control) + - [Indicate current state of lightbulb](#indicate-current-state-of-lightbulb) --- ## Supported Chips -The CHIP demo application is supported on: +The Matter demo application is supported on: - ASR582X - ASR595X -## Building the Example Application +## Building and Commissioning -- [Setup CHIP Environment](../../../docs/guides/BUILDING.md) +Please refer +[Building and Commissioning](../../../docs/guides/asr_getting_started_guide.md#building-the-example-application) +guides to get started -- Setup toolchain for ASR582X,download gcc-arm-none-eabi-9-2019-q4-major,then - export `ASR_TOOLCHAIN_PATH`: - ``` - export ASR_TOOLCHAIN_PATH={path-to-toolchain}/gcc-arm-none-eabi-9-2019-q4-major/bin/ - ``` - for ASR595X,download asr_riscv_gnu_toolchain_10.2_ubuntu,then export - `ASR_TOOLCHAIN_PATH`: - ``` - export ASR_TOOLCHAIN_PATH={path-to-toolchain}/asr_riscv_gnu_toolchain_10.2_ubuntu-16.04/bin/ - ``` -- Setup Chip environment - - for ASR582X: - ``` - export ASR_BOARD=asr582x - ``` - - for ASR595X: - ``` - export ASR_BOARD=asr595x - ``` -- Building the Application - ``` - ./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting build - ``` -- The output image files are stored in the subdirectories under `out`, the - subdirectory name is the same as the argument specified after the option - `--target` when build the examples. - -- After building the application, `DOGO` tool is used to flash it to the - board. - -## Commissioning - -There are two commissioning modes supported by ASR platform: - -### BLE mode - -1. Build and Flash -2. The example will run automatically after booting the ASR board. -3. Restore factory settings using command `recovery` -4. Commissioning with - [Chip-Tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool) - -### IP mode - -1. Build and Flash -2. The example will run automatically after booting the ASR board. -3. Restore factory settings using command `recovery` -4. Connect to AP using command `wifi_open sta [ssid] [password]` -5. Commissioning with - [Chip-Tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool) +``` +./scripts/build/build_examples.py --target asr-$ASR_BOARD-lighting build +``` ## Cluster Control @@ -96,3 +49,16 @@ After successful commissioning, use `chip-tool` to control the board ``` ./chip-tool colorcontrol move-to-hue-and-saturation 240 100 0 0 0 1 ``` + +## Indicate current state of lightbulb + +By default, a 3-color LED(RGB) module is used to show current state of lightbulb +Connect the module to following pins: + +| Name | Pin | +| :---: | :---: | +| Red | PAD7 | +| Green | PAD6 | +| Blue | PAD10 | + +These default pins are defined at `examples/platform/asr/LEDWidget.h` diff --git a/examples/platform/asr/shell/matter_shell.cpp b/examples/platform/asr/shell/matter_shell.cpp index 55a66b31cf0eaf..f84d6946f6a425 100644 --- a/examples/platform/asr/shell/matter_shell.cpp +++ b/examples/platform/asr/shell/matter_shell.cpp @@ -34,6 +34,9 @@ #include #include #include +#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR +#include "init_OTARequestor.h" +#endif using namespace ::chip; using namespace ::chip::Credentials; diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index d2024c46209733..f573feec814940 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -425,6 +425,8 @@ def BuildASRTarget(): target.AppendModifier('ota', enable_ota_requestor=True) target.AppendModifier('shell', chip_build_libshell=True) target.AppendModifier('no_logging', chip_logging=False) + target.AppendModifier('factory', enable_factory=True) + target.AppendModifier('rotating_id', enable_rotating_device_id=True) return target diff --git a/scripts/build/builders/asr.py b/scripts/build/builders/asr.py index e8ca5aa8b3f715..c329f70e29ddc7 100644 --- a/scripts/build/builders/asr.py +++ b/scripts/build/builders/asr.py @@ -60,6 +60,7 @@ def __init__(self, chip_build_libshell: bool = False, chip_logging: bool = True, enable_factory: bool = False, + enable_rotating_device_id: bool = False, enable_ota_requestor: bool = False): super(ASRBuilder, self).__init__( root=app.BuildRoot(root), @@ -104,6 +105,10 @@ def __init__(self, self.extra_gn_options.append('chip_use_transitional_commissionable_data_provider=false') self.extra_gn_options.append('chip_enable_factory_data=true') + if enable_rotating_device_id: + self.extra_gn_options.append('chip_enable_additional_data_advertising=true') + self.extra_gn_options.append('chip_enable_rotating_device_id=true') + self.extra_gn_options.append('asr_toolchain_root="%s"' % os.environ['ASR_TOOLCHAIN_PATH']) def GnBuildArgs(self): diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 821e9a84f04bc7..e4f8a8968253f8 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -1,5 +1,5 @@ ameba-amebad-{all-clusters,all-clusters-minimal,light,light-switch,pigweed} -asr-{asr582x,asr595x}-lighting[-ota][-shell][-no_logging] +asr-{asr582x,asr595x}-lighting[-ota][-shell][-no_logging][-factory][-rotating_id] android-{arm,arm64,x86,x64,androidstudio-arm,androidstudio-arm64,androidstudio-x86,androidstudio-x64}-{chip-tool,chip-test,tv-server,tv-casting-app,java-matter-controller}[-no-debug] bouffalolab-{bl602-iot-matter-v1,bl602-iot-dvk-3s,bl602-night-light,xt-zb6-devkit,bl706-iot-dvk,bl706-night-light}-light[-shell][-115200][-rpc][-cdc] cc32xx-lock diff --git a/src/platform/ASR/ASRConfig.h b/src/platform/ASR/ASRConfig.h index 10895098a1d2df..af10b47b08d2f9 100644 --- a/src/platform/ASR/ASRConfig.h +++ b/src/platform/ASR/ASRConfig.h @@ -25,8 +25,6 @@ #pragma once -// #include - #include "asr_factory_config.h" #include diff --git a/src/platform/ASR/ASROTAImageProcessor.cpp b/src/platform/ASR/ASROTAImageProcessor.cpp index beb7e6e4d2e534..92a3ab08a4da7b 100644 --- a/src/platform/ASR/ASROTAImageProcessor.cpp +++ b/src/platform/ASR/ASROTAImageProcessor.cpp @@ -150,9 +150,8 @@ void ASROTAImageProcessor::HandleApply(intptr_t context) ChipLogProgress(SoftwareUpdate, "ASROTAImageProcessor::HandleApply()"); imageProcessor->ota_boot_para.res_type = LEGA_OTA_FINISH; + // Set boot mode and then reboot lega_ota_set_boot(&imageProcessor->ota_boot_para); - - // reboot(); } void ASROTAImageProcessor::HandleAbort(intptr_t context) @@ -217,7 +216,6 @@ CHIP_ERROR ASROTAImageProcessor::ProcessHeader(ByteSpan & block) ReturnErrorCodeIf(error == CHIP_ERROR_BUFFER_TOO_SMALL, CHIP_NO_ERROR); ReturnErrorOnFailure(error); - // SL TODO -- store version somewhere ChipLogProgress(SoftwareUpdate, "Image Header software version: %ld payload size: %lu", header.mSoftwareVersion, (long unsigned int) header.mPayloadSize); mParams.totalFileBytes = header.mPayloadSize; diff --git a/src/platform/ASR/ASRUtils.cpp b/src/platform/ASR/ASRUtils.cpp index cecf87f2e20d45..1961de38e834bf 100644 --- a/src/platform/ASR/ASRUtils.cpp +++ b/src/platform/ASR/ASRUtils.cpp @@ -288,9 +288,6 @@ CHIP_ERROR ASRUtils::asr_wifi_connect(void) strncpy((char *) conf.wifi_key, (char *) stationConfig.wifi_key, stationConfig.key_len); conf.security = stationConfig.security; - // before wlan open with sta mode, make sure the wlan is closed. - // lega_wlan_close(); - ChipLogProgress(DeviceLayer, "Connecting to AP : [%s]\r\n", StringOrNullMarker(conf.wifi_ssid)); lega_wlan_clear_pmk(); diff --git a/src/platform/ASR/ConnectivityManagerImpl.cpp b/src/platform/ASR/ConnectivityManagerImpl.cpp index 6e828c897f1e19..b24e6ffe19567b 100644 --- a/src/platform/ASR/ConnectivityManagerImpl.cpp +++ b/src/platform/ASR/ConnectivityManagerImpl.cpp @@ -42,10 +42,9 @@ #include #include +#include "lega_wlan_api.h" #include "lwip/opt.h" #include -// asr wifi -#include "lega_wlan_api.h" #if !CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION #error "WiFi Station support must be enabled when building for ASR" #endif diff --git a/src/platform/ASR/KeyValueStoreManagerImpl.cpp b/src/platform/ASR/KeyValueStoreManagerImpl.cpp index bc499ae3a046fd..546cdea029592b 100644 --- a/src/platform/ASR/KeyValueStoreManagerImpl.cpp +++ b/src/platform/ASR/KeyValueStoreManagerImpl.cpp @@ -44,7 +44,7 @@ KeyValueStoreManagerImpl KeyValueStoreManagerImpl::sInstance; CHIP_ERROR KeyValueStoreManagerImpl::Init() { - // duet_flash_kv_init(); + // KV has already been initialized at init_asrPlatform(), so return success return CHIP_NO_ERROR; } diff --git a/src/platform/ASR/NetworkCommissioningWiFiDriver.cpp b/src/platform/ASR/NetworkCommissioningWiFiDriver.cpp index 5c8167569f8e78..d7ed6266706c58 100644 --- a/src/platform/ASR/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/ASR/NetworkCommissioningWiFiDriver.cpp @@ -15,14 +15,14 @@ * limitations under the License. */ +#include "lega_wlan_api.h" #include #include +#include #include #include #include #include - -#include #include using namespace ::chip; @@ -184,8 +184,7 @@ void ASRWiFiDriver::ConnectNetwork(ByteSpan networkId, ConnectCallback * callbac callback->OnResult(networkingStatus, CharSpan(), 0); } } -// asr wifi -#include "lega_wlan_api.h" + CHIP_ERROR ASRWiFiDriver::StartScanWiFiNetworks(ByteSpan ssid) { if (ASRUtils::EnableStationMode() != CHIP_NO_ERROR) diff --git a/src/platform/ASR/PlatformManagerImpl.h b/src/platform/ASR/PlatformManagerImpl.h index 890fefd72f74de..1a16797c8a9bcc 100644 --- a/src/platform/ASR/PlatformManagerImpl.h +++ b/src/platform/ASR/PlatformManagerImpl.h @@ -29,6 +29,8 @@ #include #endif #include +#include + namespace chip { namespace DeviceLayer { diff --git a/src/platform/ASR/args.gni b/src/platform/ASR/args.gni index 85217656032436..4301315205975a 100755 --- a/src/platform/ASR/args.gni +++ b/src/platform/ASR/args.gni @@ -14,6 +14,8 @@ import("//build_overrides/chip.gni") +import("${chip_root}/examples/platform/asr/args.gni") + riscv_platform_config = "${chip_root}/third_party/asr/asr_riscv.gni" chip_device_platform = "asr" From 50654bff8deeca8e8de98e267c058776b31acbfe Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 9 Jun 2023 09:21:03 -0400 Subject: [PATCH 2/6] Fix method return type (strict python noticed we return None here) (#27156) * Fix method return type (strict python noticed we return None here) * Fix typo * Fix a typo * Revert unintended repo change --------- Co-authored-by: Andrei Litvin --- scripts/py_matter_idl/matter_idl/lint/lint_rules_parser.py | 4 ++-- src/lib/support/StringSplitter.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/py_matter_idl/matter_idl/lint/lint_rules_parser.py b/scripts/py_matter_idl/matter_idl/lint/lint_rules_parser.py index 81a6158f13f542..9499e360399230 100755 --- a/scripts/py_matter_idl/matter_idl/lint/lint_rules_parser.py +++ b/scripts/py_matter_idl/matter_idl/lint/lint_rules_parser.py @@ -5,7 +5,7 @@ import xml.etree.ElementTree from dataclasses import dataclass from enum import Enum, auto -from typing import List, MutableMapping, Tuple, Union +from typing import List, MutableMapping, Optional, Tuple, Union from lark import Lark from lark.visitors import Discard, Transformer, v_args @@ -167,7 +167,7 @@ def GetLinterRules(self): def RequireAttribute(self, r: AttributeRequirement): self._required_attributes_rule.RequireAttribute(r) - def FindClusterCode(self, name: str) -> Tuple[str, int]: + def FindClusterCode(self, name: str) -> Optional[Tuple[str, int]]: if name not in self._cluster_codes: # Name may be a number. If this can be parsed as a number, accept it anyway try: diff --git a/src/lib/support/StringSplitter.h b/src/lib/support/StringSplitter.h index abeed6fa4567f9..8434f2b02c90dc 100644 --- a/src/lib/support/StringSplitter.h +++ b/src/lib/support/StringSplitter.h @@ -44,7 +44,7 @@ class StringSplitter } } - /// Returns the next character san + /// Returns the next character span /// /// out - contains the next element or a nullptr/0 sized span if /// no elements available From 7f6723f0a3b947297636143959fb8fc3c94a0fcd Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 9 Jun 2023 12:57:25 -0400 Subject: [PATCH 3/6] Pin the checkout action to v3.5.2 for now. (#27178) 3.5.3 sparse checkout support seems to break in our CI. See https://github.com/actions/checkout/issues/1378 --- .github/workflows/bloat_check.yaml | 2 +- .github/workflows/build.yaml | 10 +++++----- .github/workflows/chef.yaml | 6 +++--- .github/workflows/cherry-picks.yaml | 2 +- .github/workflows/cirque.yaml | 2 +- .github/workflows/darwin-tests.yaml | 2 +- .github/workflows/darwin.yaml | 2 +- .github/workflows/docbuild.yaml | 2 +- .github/workflows/docker_img.yaml | 2 +- .github/workflows/doxygen.yaml | 2 +- .github/workflows/examples-ameba.yaml | 2 +- .github/workflows/examples-asr.yaml | 2 +- .github/workflows/examples-bouffalolab.yaml | 2 +- .github/workflows/examples-cc13x2x7_26x2x7.yaml | 2 +- .github/workflows/examples-cc32xx.yaml | 2 +- .github/workflows/examples-efr32.yaml | 2 +- .github/workflows/examples-esp32.yaml | 4 ++-- .github/workflows/examples-infineon.yaml | 2 +- .github/workflows/examples-k32w.yaml | 2 +- .github/workflows/examples-linux-arm.yaml | 2 +- .github/workflows/examples-linux-imx.yaml | 2 +- .github/workflows/examples-linux-standalone.yaml | 2 +- .github/workflows/examples-mbed.yaml | 2 +- .github/workflows/examples-mw320.yaml | 2 +- .github/workflows/examples-nrfconnect.yaml | 2 +- .github/workflows/examples-openiotsdk.yaml | 2 +- .github/workflows/examples-qpg.yaml | 2 +- .github/workflows/examples-telink.yaml | 2 +- .github/workflows/examples-tizen.yaml | 2 +- .github/workflows/fixit_rotation.yaml | 2 +- .github/workflows/full-android.yaml | 4 ++-- .github/workflows/fuzzing-build.yaml | 4 ++-- .github/workflows/gradle-wrapper-validation.yml | 2 +- .github/workflows/java-tests.yaml | 2 +- .github/workflows/lint.yml | 4 ++-- .github/workflows/minimal-build.yaml | 2 +- .github/workflows/qemu.yaml | 4 ++-- .github/workflows/release_artifacts.yaml | 4 ++-- .github/workflows/smoketest-android.yaml | 2 +- .github/workflows/smoketest-darwin.yaml | 2 +- .github/workflows/spell.yml | 4 ++-- .github/workflows/tests.yaml | 10 +++++----- .github/workflows/todos.yaml | 2 +- .github/workflows/unit_integration_test.yaml | 2 +- .github/workflows/zap_regeneration.yaml | 2 +- .github/workflows/zap_templates.yaml | 2 +- 46 files changed, 63 insertions(+), 63 deletions(-) diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 01f041cdd0a506..f68127b364711d 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -39,7 +39,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e4c4b5d337e06e..9774faa586efbe 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -56,7 +56,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -168,7 +168,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -340,7 +340,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -391,7 +391,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -499,7 +499,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index 671eb2a7c5a47f..c426996c187054 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -42,7 +42,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -78,7 +78,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -114,7 +114,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/cherry-picks.yaml b/.github/workflows/cherry-picks.yaml index d7ef371214f890..0fd7802dc461f4 100644 --- a/.github/workflows/cherry-picks.yaml +++ b/.github/workflows/cherry-picks.yaml @@ -20,7 +20,7 @@ jobs: ) steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3.5.2 with: fetch-depth: 0 - name: Cherry-Pick into sve branch diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index ba6938efb7e19e..98baf36f6d61f3 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -57,7 +57,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/darwin-tests.yaml b/.github/workflows/darwin-tests.yaml index 825e7257851363..29f34356e5f607 100644 --- a/.github/workflows/darwin-tests.yaml +++ b/.github/workflows/darwin-tests.yaml @@ -50,7 +50,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index a7d8f31a819124..a78ab07cf02b68 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -41,7 +41,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/docbuild.yaml b/.github/workflows/docbuild.yaml index f49a9e660b4d12..ac2a8072c8045e 100644 --- a/.github/workflows/docbuild.yaml +++ b/.github/workflows/docbuild.yaml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout the code - uses: actions/checkout@v3 + uses: actions/checkout@v3.5.2 with: path: matter fetch-depth: 0 diff --git a/.github/workflows/docker_img.yaml b/.github/workflows/docker_img.yaml index b7d93bc49279ce..776a9539579585 100644 --- a/.github/workflows/docker_img.yaml +++ b/.github/workflows/docker_img.yaml @@ -62,7 +62,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 3a0dc4a9d9f8b1..15c5477c848c57 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -90,7 +90,7 @@ jobs: - name: "Print Actor" run: echo ${{github.actor}} - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3.5.2 - name: Generate run: scripts/helpers/doxygen.sh - name: Extract branch name diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 175261cef97618..e188826740668f 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -45,7 +45,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-asr.yaml b/.github/workflows/examples-asr.yaml index 08dc3095ca5d7e..7a5722cf2918c7 100644 --- a/.github/workflows/examples-asr.yaml +++ b/.github/workflows/examples-asr.yaml @@ -43,7 +43,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index e548aa4259b929..3441ad51d2bc2a 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -45,7 +45,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13x2x7_26x2x7.yaml index ff03ba8ff93f34..0ebe1b067dbd49 100644 --- a/.github/workflows/examples-cc13x2x7_26x2x7.yaml +++ b/.github/workflows/examples-cc13x2x7_26x2x7.yaml @@ -49,7 +49,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index f31cf1e8a20c28..712648d99870fe 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -47,7 +47,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index d8961dde06c5a1..0f5db5783411e4 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -48,7 +48,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index 637c797fe5ad90..5d36782b23f599 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -45,7 +45,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -170,7 +170,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index b48aafbf4937da..e05a56b215a693 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -45,7 +45,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index d5d31eddbdaba0..855f0ea88fa34b 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -47,7 +47,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index b8af253b4923aa..3b293599b00787 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -45,7 +45,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 3dd30ed119a7a0..bb633d23f9ad8c 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -43,7 +43,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index c291943771c827..8504087a83455e 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -45,7 +45,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index 5f04e7eac1a26d..e32c75300ec63a 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -51,7 +51,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 9d64805bcb3b64..0d1a285f0de841 100755 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -47,7 +47,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index cb1c94f5915eae..034a532a93f25d 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -48,7 +48,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index d2f2e904c70827..08f46969daee9b 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -50,7 +50,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index bf97acb89b13ba..ab7d33b5ccab90 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -47,7 +47,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 8bddf9aa69b81c..74e050bb05f438 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -46,7 +46,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index dc6240fe45cbd6..a0f33c521040cd 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -46,7 +46,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/fixit_rotation.yaml b/.github/workflows/fixit_rotation.yaml index ac5383f789630a..c7ffed5302fae3 100644 --- a/.github/workflows/fixit_rotation.yaml +++ b/.github/workflows/fixit_rotation.yaml @@ -26,7 +26,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | submodules: true token: ${{ github.token }} diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 7239575c686d4b..3b39c71b58a836 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -48,7 +48,7 @@ jobs: if: ${{ !env.ACT }} name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -59,7 +59,7 @@ jobs: # Note you likely still need to have non submodules setup for the # local machine, like: # git submodule deinit --all - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.5.2 if: ${{ env.ACT }} name: Checkout (ACT for local build) - name: Checkout submodules diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 68b62b88d87e12..4e589a98460b2b 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -44,7 +44,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | submodules: true token: ${{ github.token }} @@ -104,7 +104,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | submodules: true token: ${{ github.token }} diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml index 8bfd0dcf51f572..913c5672e3c09e 100644 --- a/.github/workflows/gradle-wrapper-validation.yml +++ b/.github/workflows/gradle-wrapper-validation.yml @@ -6,5 +6,5 @@ jobs: name: "Validation" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.5.2 - uses: gradle/wrapper-validation-action@v1 diff --git a/.github/workflows/java-tests.yaml b/.github/workflows/java-tests.yaml index 911c11ddbef771..37ebeeea0a01fa 100644 --- a/.github/workflows/java-tests.yaml +++ b/.github/workflows/java-tests.yaml @@ -49,7 +49,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3.5.2 - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Try to ensure the directories for core dumping exist and we diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8a770ecb46b6f0..da846e5939ea0a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -40,7 +40,7 @@ jobs: if: ${{ !env.ACT }} name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -51,7 +51,7 @@ jobs: # Note you likely still need to have non submodules setup for the # local machine, like: # git submodule deinit --all - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.5.2 if: ${{ env.ACT }} name: Checkout (ACT for local build) diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index 67d9bbfdd642f8..77b801a749fb3a 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -36,7 +36,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3.5.2 - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Configure and build All Clusters App diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index b8d68f4a3a243e..2459ecbcaa5576 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -49,7 +49,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -113,7 +113,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index fc371f695ab25e..a525a97db0742d 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -40,7 +40,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | submodules: true token: ${{ github.token }} @@ -95,7 +95,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | submodules: true token: ${{ github.token }} diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index de1d5ab89e8cfb..cce15a04079562 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -48,7 +48,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/smoketest-darwin.yaml b/.github/workflows/smoketest-darwin.yaml index 0ab19f6dd92d44..13f328b02988e8 100644 --- a/.github/workflows/smoketest-darwin.yaml +++ b/.github/workflows/smoketest-darwin.yaml @@ -41,7 +41,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/spell.yml b/.github/workflows/spell.yml index f073c203385e53..3de0afa566469d 100644 --- a/.github/workflows/spell.yml +++ b/.github/workflows/spell.yml @@ -32,7 +32,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -47,7 +47,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 14146339d5844b..2d641bb21a0e53 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -59,7 +59,7 @@ jobs: if: ${{ !env.ACT }} name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -70,7 +70,7 @@ jobs: # Note you likely still need to have non submodules setup for the # local machine, like: # git submodule deinit --all - - uses: actions/checkout@v3 + - uses: actions/checkout@v3.5.2 if: ${{ env.ACT }} name: Checkout (ACT for local build) - name: Checkout submodules @@ -332,7 +332,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 @@ -463,7 +463,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3.5.2 - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux - name: Try to ensure the directories for core dumping exist and we @@ -551,7 +551,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3.5.2 - name: Checkout submodules run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform darwin - name: Setup Environment diff --git a/.github/workflows/todos.yaml b/.github/workflows/todos.yaml index 4381b3ca9d7638..f7e82d5f217eca 100644 --- a/.github/workflows/todos.yaml +++ b/.github/workflows/todos.yaml @@ -26,7 +26,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index c42595e1c98129..9a22f6bc0d6d71 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -47,7 +47,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index 22cdb0430bc494..f30714c2a6bf65 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -43,7 +43,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | submodules: true token: ${{ github.token }} diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 60513c863eec92..04cb6b8990af72 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -45,7 +45,7 @@ jobs: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout with: - action: actions/checkout@v3 + action: actions/checkout@v3.5.2 with: | token: ${{ github.token }} attempt_limit: 3 From d676bae2cb26636928a90ba23162db8cbe4f0e58 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 9 Jun 2023 13:12:53 -0400 Subject: [PATCH 4/6] Fix darwin-framework-tool build. (#27177) A merge conflict between #26882 and #27152 led to it not building. --- .../templates/tests/ciTests.json | 36 +- .../zap-generated/test/Commands.h | 6986 +---------------- 2 files changed, 117 insertions(+), 6905 deletions(-) diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index 109ffe2c10e07c..4d33395f379753 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -1,7 +1,6 @@ { "include": "../../../../src/app/tests/suites/ciTests.json", "disable": [ - "TestIcdManagementCluster", "Test_TC_SC_4_2", "Test_TC_SC_5_2", "TestClusterComplexTypes", @@ -32,6 +31,39 @@ "Test_TC_ACL_2_9", "Test_TC_ACL_2_10", "DL_LockUnlock", - "Test_TC_TIMESYNC_1_1" + "Disabled due to using ICD Management (ICDManagement) cluster, which is provisional on Darwin for now:", + "TestIcdManagementCluster", + "Disabled due to using Time Synchronization (TimeSynchronization) cluster, which is provisional on Darwin for now:", + "Test_TC_TIMESYNC_1_1", + "Disabled due to using provisional Ceramic Filter Monitoring (CeramicFilterMonitoring) cluster:", + "Test_TC_CFREMON_1_1", + "Test_TC_CFREMON_2_1", + "Disabled due to using provisional Electrostatic Filter Monitoring (ElectrostaticFilterMonitoring) cluster:", + "Test_TC_ESFREMON_1_1", + "Test_TC_ESFREMON_2_1", + "Disabled due to using provisional Fuel Tank Monitoring (FuelTankMonitoring) cluster:", + "Test_TC_FTREMON_1_1", + "Test_TC_FTREMON_2_1", + "Disabled due to using provisional Ink Cartridge Monitoring (InkCartridgeMonitoring) cluster:", + "Test_TC_INKCREMON_1_1", + "Test_TC_INKCREMON_2_1", + "Disabled due to using provisional Ionizing Filter Monitoring (IonizingFilterMonitoring) cluster:", + "Test_TC_IONFREMON_1_1", + "Test_TC_IONFREMON_2_1", + "Disabled due to using provisional Ozone Filter Monitoring (OzoneFilterMonitoring) cluster:", + "Test_TC_OZFREMON_1_1", + "Test_TC_OZFREMON_2_1", + "Disabled due to using provisional Toner Cartridge Monitoring (TonerCartridgeMonitoring) cluster:", + "Test_TC_TCREMON_1_1", + "Test_TC_TCREMON_2_1", + "Disabled due to using provisional UV Filter Monitoring (UVFilterMonitoring) cluster:", + "Test_TC_UVFREMON_1_1", + "Test_TC_UVFREMON_2_1", + "Disabled due to using provisional Water Tank Monitoring (WaterTankMonitoring) cluster:", + "Test_TC_WTREMON_1_1", + "Test_TC_WTREMON_2_1", + "Disabled due to using provisional Zeolite Filter Monitoring (ZeoliteFilterMonitoring) cluster:", + "Test_TC_ZEOFREMON_1_1", + "Test_TC_ZEOFREMON_2_1" ] } diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 54567b27ed5ba4..025c152bed88cc 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -247,28 +247,8 @@ class TestList : public Command { printf("Test_TC_G_1_1\n"); printf("Test_TC_ACFREMON_1_1\n"); printf("Test_TC_ACFREMON_2_1\n"); - printf("Test_TC_CFREMON_1_1\n"); - printf("Test_TC_CFREMON_2_1\n"); - printf("Test_TC_ESFREMON_1_1\n"); - printf("Test_TC_ESFREMON_2_1\n"); - printf("Test_TC_FTREMON_1_1\n"); - printf("Test_TC_FTREMON_2_1\n"); printf("Test_TC_HEPAFREMON_1_1\n"); printf("Test_TC_HEPAFREMON_2_1\n"); - printf("Test_TC_INKCREMON_1_1\n"); - printf("Test_TC_INKCREMON_2_1\n"); - printf("Test_TC_IONFREMON_1_1\n"); - printf("Test_TC_IONFREMON_2_1\n"); - printf("Test_TC_OZFREMON_1_1\n"); - printf("Test_TC_OZFREMON_2_1\n"); - printf("Test_TC_TCREMON_1_1\n"); - printf("Test_TC_TCREMON_2_1\n"); - printf("Test_TC_UVFREMON_1_1\n"); - printf("Test_TC_UVFREMON_2_1\n"); - printf("Test_TC_WTREMON_1_1\n"); - printf("Test_TC_WTREMON_2_1\n"); - printf("Test_TC_ZEOFREMON_1_1\n"); - printf("Test_TC_ZEOFREMON_2_1\n"); return CHIP_NO_ERROR; } @@ -147238,6791 +147218,11 @@ class Test_TC_ACFREMON_2_1 : public TestCommandBridge { } }; -class Test_TC_CFREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_CFREMON_1_1() - : TestCommandBridge("Test_TC_CFREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_CFREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CFREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CFREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!CFREMON.S.F00 && !CFREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given CFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("CFREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenCFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given CFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("CFREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenCFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(CFREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("CFREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentCFREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress( - chipTool, " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (CFREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("CFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorCfremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("CFREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenCFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given CFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenCFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given CFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentCFREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(CFREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorCfremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (CFREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_CFREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_CFREMON_2_1() - : TestCommandBridge("Test_TC_CFREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_CFREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_CFREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CFREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("CFREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("CFREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("CFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("CFREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ESFREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ESFREMON_1_1() - : TestCommandBridge("Test_TC_ESFREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_ESFREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ESFREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ESFREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!ESFREMON.S.F00 && !ESFREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given ESFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("ESFREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenESFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given ESFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("ESFREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenESFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(ESFREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("ESFREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentESFREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (ESFREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("ESFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorEsfremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("ESFREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenESFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given ESFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenESFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given ESFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentESFREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(ESFREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorEsfremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (ESFREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ESFREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ESFREMON_2_1() - : TestCommandBridge("Test_TC_ESFREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_ESFREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ESFREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ESFREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("ESFREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("ESFREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("ESFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("ESFREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FTREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_FTREMON_1_1() - : TestCommandBridge("Test_TC_FTREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_FTREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FTREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FTREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!FTREMON.S.F00 && !FTREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given FTREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("FTREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenFTREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given FTREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("FTREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenFTREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(FTREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("FTREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentFTREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress( - chipTool, " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (FTREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("FTREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorFtremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("FTREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenFTREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given FTREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenFTREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given FTREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentFTREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(FTREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorFtremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (FTREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_FTREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_FTREMON_2_1() - : TestCommandBridge("Test_TC_FTREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_FTREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_FTREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FTREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("FTREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("FTREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("FTREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("FTREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_HEPAFREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_HEPAFREMON_1_1() - : TestCommandBridge("Test_TC_HEPAFREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_HEPAFREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_HEPAFREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_HEPAFREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!HEPAFREMON.S.F00 && !HEPAFREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given HEPAFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("HEPAFREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenHEPAFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given HEPAFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("HEPAFREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenHEPAFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(HEPAFREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("HEPAFREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentHEPAFREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (HEPAFREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("HEPAFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorHepafremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("HEPAFREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenHEPAFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given HEPAFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenHEPAFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given HEPAFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentHEPAFREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(HEPAFREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorHepafremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (HEPAFREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_HEPAFREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_HEPAFREMON_2_1() - : TestCommandBridge("Test_TC_HEPAFREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_HEPAFREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_HEPAFREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_HEPAFREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("HEPAFREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("HEPAFREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("HEPAFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("HEPAFREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_INKCREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_INKCREMON_1_1() - : TestCommandBridge("Test_TC_INKCREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_INKCREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_INKCREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_INKCREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!INKCREMON.S.F00 && !INKCREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given INKCREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("INKCREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenINKCREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given INKCREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("INKCREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenINKCREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(INKCREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("INKCREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentINKCREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (INKCREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("INKCREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorInkcremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("INKCREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenINKCREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given INKCREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenINKCREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given INKCREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentINKCREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(INKCREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorInkcremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (INKCREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_INKCREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_INKCREMON_2_1() - : TestCommandBridge("Test_TC_INKCREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_INKCREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_INKCREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_INKCREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("INKCREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("INKCREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("INKCREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("INKCREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_IONFREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_IONFREMON_1_1() - : TestCommandBridge("Test_TC_IONFREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_IONFREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IONFREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IONFREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!IONFREMON.S.F00 && !IONFREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given IONFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("IONFREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenIONFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given IONFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("IONFREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenIONFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(IONFREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("IONFREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentIONFREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (IONFREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("IONFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorIonfremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("IONFREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenIONFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given IONFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenIONFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given IONFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentIONFREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(IONFREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorIonfremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (IONFREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_IONFREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_IONFREMON_2_1() - : TestCommandBridge("Test_TC_IONFREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_IONFREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_IONFREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IONFREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("IONFREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("IONFREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("IONFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("IONFREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OZFREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_OZFREMON_1_1() - : TestCommandBridge("Test_TC_OZFREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_OZFREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OZFREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OZFREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!OZFREMON.S.F00 && !OZFREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given OZFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("OZFREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenOZFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given OZFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("OZFREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenOZFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(OZFREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("OZFREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentOZFREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (OZFREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("OZFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorOzfremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("OZFREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenOZFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given OZFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenOZFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given OZFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentOZFREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(OZFREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorOzfremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (OZFREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_OZFREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_OZFREMON_2_1() - : TestCommandBridge("Test_TC_OZFREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_OZFREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_OZFREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OZFREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("OZFREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("OZFREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("OZFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("OZFREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TCREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_TCREMON_1_1() - : TestCommandBridge("Test_TC_TCREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_TCREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TCREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TCREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!TCREMON.S.F00 && !TCREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given TCREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("TCREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenTCREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given TCREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("TCREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenTCREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(TCREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("TCREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentTCREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress( - chipTool, " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (TCREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("TCREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorTcremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("TCREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenTCREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given TCREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenTCREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given TCREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentTCREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(TCREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorTcremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (TCREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_TCREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_TCREMON_2_1() - : TestCommandBridge("Test_TC_TCREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_TCREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_TCREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TCREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("TCREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("TCREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("TCREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("TCREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_UVFREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_UVFREMON_1_1() - : TestCommandBridge("Test_TC_UVFREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_UVFREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_UVFREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_UVFREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!UVFREMON.S.F00 && !UVFREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given UVFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("UVFREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenUVFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given UVFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("UVFREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenUVFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(UVFREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("UVFREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentUVFREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress(chipTool, - " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (UVFREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("UVFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorUvfremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("UVFREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenUVFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given UVFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenUVFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given UVFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentUVFREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(UVFREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorUvfremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (UVFREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_UVFREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_UVFREMON_2_1() - : TestCommandBridge("Test_TC_UVFREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_UVFREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_UVFREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_UVFREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("UVFREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("UVFREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("UVFREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("UVFREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WTREMON_1_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_WTREMON_1_1() - : TestCommandBridge("Test_TC_WTREMON_1_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_WTREMON_1_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WTREMON_1_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WTREMON_1_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!WTREMON.S.F00 && !WTREMON.S.F01")) { - NextTest(); - return; - } - err = TestReadTheGlobalAttributeFeatureMap_2(); - break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Given WTREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("WTREMON.S.F00")) { - NextTest(); - return; - } - err = TestGivenWTREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); - break; - case 4: - ChipLogProgress( - chipTool, " ***** Test Step 4 : Given WTREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("WTREMON.S.F01")) { - NextTest(); - return; - } - err = TestGivenWTREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); - break; - case 6: - ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(WTREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("WTREMON.S.F00")) { - NextTest(); - return; - } - err = TestReadTheFeatureDependentWTREMONSF00AttributeInAttributeList_6(); - break; - case 7: - ChipLogProgress( - chipTool, " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (WTREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("WTREMON.S.A0002")) { - NextTest(); - return; - } - err = TestReadTheOptionalAttributeInPlaceIndicatorWtremonsa0002InAttributeList_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); - err = TestReadTheGlobalAttributeAcceptedCommandList_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("WTREMON.S.C00.Rsp")) { - NextTest(); - return; - } - err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); - err = TestReadTheGlobalAttributeGeneratedCommandList_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); - err = TestThReadsEventListAttributeFromDut_11(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 5: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 6: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 7: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 8: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 9: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 10: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 11: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - - VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: FeatureMap Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); - } - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenWTREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given WTREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestGivenWTREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given WTREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheFeatureDependentWTREMONSF00AttributeInAttributeList_6() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(WTREMON.S.F00) attribute in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorWtremonsa0002InAttributeList_7() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (WTREMON.S.A0002) in AttributeList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); - VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsEventListAttributeFromDut_11() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads EventList attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); - } - - VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_WTREMON_2_1 : public TestCommandBridge { -public: - // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_WTREMON_2_1() - : TestCommandBridge("Test_TC_WTREMON_2_1") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - - ~Test_TC_WTREMON_2_1() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_WTREMON_2_1\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WTREMON_2_1\n"); - SetCommandExitStatus(CHIP_NO_ERROR); - return; - } - - Wait(); - - // Ensure we increment mTestIndex before we start running the relevant - // command. That way if we lose the timeslice after we send the message - // but before our function call returns, we won't end up with an - // incorrect mTestIndex value observed when we get the response. - switch (mTestIndex++) { - case 0: - ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); - break; - case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("WTREMON.S.A0000")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheConditionAttribute_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("WTREMON.S.A0001")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("WTREMON.S.A0002")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("WTREMON.S.A0003")) { - NextTest(); - return; - } - err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - void OnStatusUpdate(const chip::app::StatusIB & status) override - { - switch (mTestIndex - 1) { - case 0: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 1: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 2: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 3: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - case 4: - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); - break; - } - - // Go on to the next test. - ContinueOnChipMainThread(CHIP_NO_ERROR); - } - - chip::System::Clock::Timeout GetWaitDuration() const override - { - return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); - } - -private: - std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - - chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; - value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; - return WaitForCommissionee("alpha", value); - } - - CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); - VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); - VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() - { - - MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); - - VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); - - VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - -class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { +class Test_TC_HEPAFREMON_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ZEOFREMON_1_1() - : TestCommandBridge("Test_TC_ZEOFREMON_1_1") + Test_TC_HEPAFREMON_1_1() + : TestCommandBridge("Test_TC_HEPAFREMON_1_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -154032,7 +147232,7 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_ZEOFREMON_1_1() {} + ~Test_TC_HEPAFREMON_1_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -154040,11 +147240,11 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ZEOFREMON_1_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_HEPAFREMON_1_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ZEOFREMON_1_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_HEPAFREMON_1_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -154066,7 +147266,7 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); - if (ShouldSkip("!ZEOFREMON.S.F00 && !ZEOFREMON.S.F01")) { + if (ShouldSkip("!HEPAFREMON.S.F00 && !HEPAFREMON.S.F01")) { NextTest(); return; } @@ -154074,21 +147274,21 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { break; case 3: ChipLogProgress( - chipTool, " ***** Test Step 3 : Given ZEOFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("ZEOFREMON.S.F00")) { + chipTool, " ***** Test Step 3 : Given HEPAFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("HEPAFREMON.S.F00")) { NextTest(); return; } - err = TestGivenZEOFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + err = TestGivenHEPAFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); break; case 4: ChipLogProgress( - chipTool, " ***** Test Step 4 : Given ZEOFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); - if (ShouldSkip("ZEOFREMON.S.F01")) { + chipTool, " ***** Test Step 4 : Given HEPAFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("HEPAFREMON.S.F01")) { NextTest(); return; } - err = TestGivenZEOFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + err = TestGivenHEPAFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); break; case 5: ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); @@ -154096,21 +147296,21 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { break; case 6: ChipLogProgress( - chipTool, " ***** Test Step 6 : Read the feature dependent(ZEOFREMON.S.F00) attribute in AttributeList\n"); - if (ShouldSkip("ZEOFREMON.S.F00")) { + chipTool, " ***** Test Step 6 : Read the feature dependent(HEPAFREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("HEPAFREMON.S.F00")) { NextTest(); return; } - err = TestReadTheFeatureDependentZEOFREMONSF00AttributeInAttributeList_6(); + err = TestReadTheFeatureDependentHEPAFREMONSF00AttributeInAttributeList_6(); break; case 7: ChipLogProgress(chipTool, - " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (ZEOFREMON.S.A0002) in AttributeList\n"); - if (ShouldSkip("ZEOFREMON.S.A0002")) { + " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (HEPAFREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("HEPAFREMON.S.A0002")) { NextTest(); return; } - err = TestReadTheOptionalAttributeInPlaceIndicatorZeofremonsa0002InAttributeList_7(); + err = TestReadTheOptionalAttributeInPlaceIndicatorHepafremonsa0002InAttributeList_7(); break; case 8: ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); @@ -154118,7 +147318,7 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { break; case 9: ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); - if (ShouldSkip("ZEOFREMON.S.C00.Rsp")) { + if (ShouldSkip("HEPAFREMON.S.C00.Rsp")) { NextTest(); return; } @@ -154211,9 +147411,9 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -154237,9 +147437,9 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -154259,17 +147459,17 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestGivenZEOFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + CHIP_ERROR TestGivenHEPAFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given ZEOFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + NSLog(@"Given HEPAFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -154280,17 +147480,17 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestGivenZEOFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + CHIP_ERROR TestGivenHEPAFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Given ZEOFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + NSLog(@"Given HEPAFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -154305,9 +147505,9 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -154330,17 +147530,17 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheFeatureDependentZEOFREMONSF00AttributeInAttributeList_6() + CHIP_ERROR TestReadTheFeatureDependentHEPAFREMONSF00AttributeInAttributeList_6() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the feature dependent(ZEOFREMON.S.F00) attribute in AttributeList Error: %@", err); + NSLog(@"Read the feature dependent(HEPAFREMON.S.F00) attribute in AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -154354,17 +147554,17 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorZeofremonsa0002InAttributeList_7() + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorHepafremonsa0002InAttributeList_7() { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional attribute InPlaceIndicator (ZEOFREMON.S.A0002) in AttributeList Error: %@", err); + NSLog(@"Read the optional attribute InPlaceIndicator (HEPAFREMON.S.A0002) in AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); @@ -154381,9 +147581,9 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -154402,9 +147602,9 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -154425,9 +147625,9 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -154451,9 +147651,9 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { @@ -154474,11 +147674,11 @@ class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { } }; -class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { +class Test_TC_HEPAFREMON_2_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced - Test_TC_ZEOFREMON_2_1() - : TestCommandBridge("Test_TC_ZEOFREMON_2_1") + Test_TC_HEPAFREMON_2_1() + : TestCommandBridge("Test_TC_HEPAFREMON_2_1") , mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); @@ -154488,7 +147688,7 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { } // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) - ~Test_TC_ZEOFREMON_2_1() {} + ~Test_TC_HEPAFREMON_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -154496,11 +147696,11 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { CHIP_ERROR err = CHIP_NO_ERROR; if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: Test_TC_ZEOFREMON_2_1\n"); + ChipLogProgress(chipTool, " **** Test Start: Test_TC_HEPAFREMON_2_1\n"); } if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ZEOFREMON_2_1\n"); + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_HEPAFREMON_2_1\n"); SetCommandExitStatus(CHIP_NO_ERROR); return; } @@ -154518,7 +147718,7 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { break; case 1: ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); - if (ShouldSkip("ZEOFREMON.S.A0000")) { + if (ShouldSkip("HEPAFREMON.S.A0000")) { NextTest(); return; } @@ -154526,7 +147726,7 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { break; case 2: ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); - if (ShouldSkip("ZEOFREMON.S.A0001")) { + if (ShouldSkip("HEPAFREMON.S.A0001")) { NextTest(); return; } @@ -154534,7 +147734,7 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { break; case 3: ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); - if (ShouldSkip("ZEOFREMON.S.A0002")) { + if (ShouldSkip("HEPAFREMON.S.A0002")) { NextTest(); return; } @@ -154542,7 +147742,7 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); - if (ShouldSkip("ZEOFREMON.S.A0003")) { + if (ShouldSkip("HEPAFREMON.S.A0003")) { NextTest(); return; } @@ -154606,9 +147806,9 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -154630,9 +147830,9 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -154654,9 +147854,9 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -154678,9 +147878,9 @@ class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { { MTRBaseDevice * device = GetDevice("alpha"); - __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device - endpointID:@(1) - queue:mCallbackQueue]; + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { @@ -154917,28 +148117,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), make_unique(), make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), - make_unique(), #endif // CONFIG_ENABLE_YAML_TESTS }; From 12d8fecea959532396b2b89069f9df43b3d994ac Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 9 Jun 2023 13:45:38 -0400 Subject: [PATCH 5/6] Fix spelling error carried over from spec (#27173) Fixes:#25974 --- src/app/tests/suites/certification/PICS.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index ed767818f71afb..c361661a9a17cb 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -6915,7 +6915,7 @@ PICS: id: DGTHREAD.S.A0033 - label: - "Does the DUT(server) support the RxErrInvalidScrAddrCount attribute?" + "Does the DUT(server) support the RxErrInvalidSrcAddrCount attribute?" id: DGTHREAD.S.A0034 - label: "Does the DUT(server) support the RxErrSecCount attribute?" @@ -7255,7 +7255,7 @@ PICS: - label: "Does the DUT(client) have access privileges for the - RxErrInvalidScrAddrCount attribute implemented on the server?" + RxErrInvalidSrcAddrCount attribute implemented on the server?" id: DGTHREAD.C.A0034 - label: From 40fb7c246671e9d37ca8bb2cfbf37f81c1509334 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 9 Jun 2023 15:35:53 -0400 Subject: [PATCH 6/6] Update cloudbuild vscode version to be uniform ... somehow this line was not updated to latest (#27182) Co-authored-by: Andrei Litvin --- integrations/cloudbuild/smoke-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index 1134778bda2714..e3f18bcc42bef5 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" git submodule update --init --recursive id: Submodules - - name: "connectedhomeip/chip-build-vscode:0.7.3" + - name: "connectedhomeip/chip-build-vscode:0.7.16" env: - PW_ENVIRONMENT_ROOT=/pwenv args: