diff --git a/.github/labeler.yml b/.github/labeler.yml index 1062287b335043..31e310088a0a0b 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -148,6 +148,10 @@ app: - src/app/* - src/app/**/* +icd: + - src/app/icd/* + - src/app/icd/**/* + transport: - src/transport/* - src/transport/**/* @@ -185,9 +189,9 @@ darwin: - examples/darwin-framework-tool/* - examples/darwin-framework-tool/**/* -efr32: - - src/platform/efr32/* - - src/platform/efr32/**/* +silabs: + - src/platform/silabs/* + - src/platform/silabs/**/* esp32: - src/platform/ESP32/* diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 14ced0ab7474a8..c3914b86230305 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -174,6 +174,8 @@ jobs: BUILD_TYPE=gcc_release scripts/build/gn_gen.sh --args="is_debug=false" scripts/run_in_build_env.sh "ninja -C ./out/gcc_release" BUILD_TYPE=gcc_release scripts/tests/gn_tests.sh + - name: Clean output + run: rm -rf ./out - name: Run Tests with sanitizers env: LSAN_OPTIONS: detect_leaks=1 diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 425b49fdf84ae3..ef2ff751283ba9 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -5,7 +5,7 @@ "compileCommands": "${workspaceFolder}/out/debug/compile_commands.gcc.json", "compilerPath": "/usr/bin/gcc", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-x64", "browse": { "path": ["${workspaceFolder}/out/debug/"], @@ -17,7 +17,7 @@ "compileCommands": "${workspaceFolder}/out/debug/compile_commands.clang.json", "compilerPath": "/usr/bin/clang", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "clang-x64", "browse": { "path": ["${workspaceFolder}/out/debug/"], @@ -29,7 +29,7 @@ "compileCommands": "${workspaceFolder}/out/debug/compile_commands.mbedtls.json", "compilerPath": "/usr/bin/gcc", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-x64", "browse": { "path": ["${workspaceFolder}/out/debug/"], @@ -39,7 +39,7 @@ { "name": "Android x64 debug (GN)", "cStandard": "c11", - "cppStandard": "c++11", + "cppStandard": "gnu++17", "intelliSenseMode": "clang-x64", "compileCommands": "${workspaceFolder}/out/debug/compile_commands.android_x64.json", "compilerPath": "/opt/android/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android24-clang", @@ -51,7 +51,7 @@ { "name": "Android arm64 debug (GN)", "cStandard": "c11", - "cppStandard": "c++11", + "cppStandard": "gnu++17", "intelliSenseMode": "clang-arm64", "compileCommands": "${workspaceFolder}/out/debug/compile_commands.android_arm64.json", "compilerPath": "/opt/android/android-ndk-r21b/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android24-clang", @@ -63,7 +63,7 @@ { "name": "EFR32 examples debug (GN)", "cStandard": "c11", - "cppStandard": "c++11", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-arm", "compileCommands": "${workspaceFolder}/out/debug/compile_commands.efr32.json", "compilerPath": "/opt/ARM-software/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc", @@ -75,7 +75,7 @@ { "name": "nRF Connect examples debug (GN)", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-arm", "compilerPath": "/opt/ARM-software/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc", "browse": { @@ -86,7 +86,7 @@ { "name": "Tizen examples debug (GN)", "cStandard": "c11", - "cppStandard": "gnu++14", + "cppStandard": "gnu++17", "intelliSenseMode": "gcc-arm", "compilerPath": "/opt/tizen-sdk/tools/arm-linux-gnueabi-gcc-9.2/bin/arm-linux-gnueabi-gcc", "compileCommands": "${workspaceFolder}/out/debug/compile_commands.tizen_arm.json", diff --git a/.vscode/settings.json b/.vscode/settings.json index e1a1725bcfbadb..7524bf25d83ec2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -166,7 +166,7 @@ ], "clang-format.fallbackStyle": "WebKit", "files.trimFinalNewlines": true, - "C_Cpp.default.cppStandard": "gnu++14", + "C_Cpp.default.cppStandard": "gnu++17", "C_Cpp.default.cStandard": "gnu11", "cmake.configureOnOpen": false, "search.followSymlinks": false, diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index 12a93863be8ce0..74dc224f3ecec7 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni @@ -43,12 +43,7 @@ declare_args() { c_standard = "gnu11" # C++ standard level (value for -std flag). - if (current_os == "linux" || current_os == "mac" || current_os == "ios" || - current_os == "android") { - cpp_standard = "gnu++17" - } else { - cpp_standard = "gnu++14" - } + cpp_standard = "gnu++17" # enable libfuzzer is_libfuzzer = false diff --git a/config/ameba/args.gni b/config/ameba/args.gni index 51634a9d738da6..a60eee6db2887c 100755 --- a/config/ameba/args.gni +++ b/config/ameba/args.gni @@ -37,4 +37,3 @@ custom_toolchain = "//third_party/connectedhomeip/config/ameba/toolchain:ameba" pw_build_PIP_CONSTRAINTS = [ "//third_party/connectedhomeip/scripts/setup/constraints.txt" ] -cpp_standard = "c++17" diff --git a/config/mbed/CMakeLists.txt b/config/mbed/CMakeLists.txt index a7006062f12ace..88567b604e3254 100644 --- a/config/mbed/CMakeLists.txt +++ b/config/mbed/CMakeLists.txt @@ -106,9 +106,7 @@ matter_get_compiler_flags_from_targets("${CONFIG_CHIP_EXTERNAL_TARGETS}") matter_add_flags(-D__LINUX_ERRNO_EXTENSIONS__=1) matter_add_flags(-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=) -if (CONFIG_CHIP_PW_RPC) - matter_add_gnu_cpp_standard("17") -endif() +matter_add_gnu_cpp_standard("17") if (CONFIG_MBED_BSD_SOCKET_TRACE) matter_add_flags(-DMBED_BSD_SOCKET_TRACE=1) diff --git a/config/telink/app/bootloader.conf b/config/telink/app/bootloader.conf new file mode 100644 index 00000000000000..5fb0182690cdaa --- /dev/null +++ b/config/telink/app/bootloader.conf @@ -0,0 +1,30 @@ +# +# 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. +# + +# Enable this option in case if restoring the slot0 partition is expected from slot1 +# partition in case if slot0 is not bootable or damaged +CONFIG_BOOT_BOOTSTRAP=n + +# Enable this option in case if SWAP_MOVE logic need to be used +CONFIG_BOOT_SWAP_USING_MOVE=y + +# Enable this option in case if SWAP_MOVE using scratch logic need to be used +# Enabling this option expecting the availability of scratch partition in DTS +CONFIG_BOOT_SWAP_USING_SCRATCH=n + +# Enable this option in case if the whole slot0 image need to be validated +# With disabled option the only image magic is validated +CONFIG_BOOT_VALIDATE_SLOT0=y diff --git a/config/telink/app/zephyr.conf b/config/telink/app/zephyr.conf index e7a211be69bd70..6948ce36b083d3 100644 --- a/config/telink/app/zephyr.conf +++ b/config/telink/app/zephyr.conf @@ -15,7 +15,7 @@ # CONFIG_CHIP=y -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Logging (set CONFIG_SERIAL to 'y' to enable logging and 'n' to disable logging) CONFIG_SERIAL=y diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index 8ff944fd1bfba2..26f0d58612abe8 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -143,11 +143,17 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/config/telink/app/bootloader.conf") + set(GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE "${CHIP_ROOT}/config/telink/app/bootloader.conf") +else() + unset(GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE) +endif() + if (CONFIG_CHIP_OTA_IMAGE_BUILD) add_custom_target(build_mcuboot ALL COMMAND west build -b ${BOARD} -d build_mcuboot ${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr - -- -DCONFIG_BOOT_SWAP_USING_MOVE=y -DDTC_OVERLAY_FILE=${GLOBAL_DTC_OVERLAY_FILE} + -- -DOVERLAY_CONFIG=${GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE=${GLOBAL_DTC_OVERLAY_FILE} ) add_custom_target(merge_mcuboot ALL diff --git a/examples/all-clusters-app/all-clusters-common/include/resource-monitoring-instances.h b/examples/all-clusters-app/all-clusters-common/include/resource-monitoring-instances.h index c12a686735abba..276e423626c1d7 100644 --- a/examples/all-clusters-app/all-clusters-common/include/resource-monitoring-instances.h +++ b/examples/all-clusters-app/all-clusters-common/include/resource-monitoring-instances.h @@ -55,23 +55,9 @@ class HepaFilterMonitoringInstance : public chip::app::Clusters::ResourceMonitor aResetConditionCommandSupported){}; }; -class StaticReplacementProductListManager : public chip::app::Clusters::ResourceMonitoring::ReplacementProductListManager +class ImmutableReplacementProductListManager : public chip::app::Clusters::ResourceMonitoring::ReplacementProductListManager { public: - uint8_t Size() override { return mReplacementProductListSize; }; - - CHIP_ERROR Next(chip::app::Clusters::ResourceMonitoring::Attributes::ReplacementProductStruct::Type & item) override; - - ~StaticReplacementProductListManager() {} - StaticReplacementProductListManager( - chip::app::Clusters::ResourceMonitoring::Attributes::ReplacementProductStruct::Type * aReplacementProductsList, - uint8_t aReplacementProductListSize) - { - mReplacementProductsList = aReplacementProductsList; - mReplacementProductListSize = aReplacementProductListSize; - } - -private: - chip::app::Clusters::ResourceMonitoring::Attributes::ReplacementProductStruct::Type * mReplacementProductsList; - uint8_t mReplacementProductListSize; + CHIP_ERROR + Next(chip::app::Clusters::ResourceMonitoring::ReplacementProductStruct & item) override; }; diff --git a/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp b/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp index c96ec297a2e2d2..65de4f9dc6e85e 100644 --- a/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/dishwasher-mode.cpp @@ -85,7 +85,8 @@ void DishwasherMode::Shutdown() } if (gDishwasherModeDelegate != nullptr) { - gDishwasherModeDelegate->~DishwasherModeDelegate(); + delete gDishwasherModeDelegate; + gDishwasherModeDelegate = nullptr; } } diff --git a/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp b/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp index 9d05b4b58850e0..bf5337277ce430 100644 --- a/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/laundry-washer-mode.cpp @@ -84,7 +84,8 @@ void LaundryWasherMode::Shutdown() } if (gLaundryWasherModeDelegate != nullptr) { - gLaundryWasherModeDelegate->~LaundryWasherModeDelegate(); + delete gLaundryWasherModeDelegate; + gLaundryWasherModeDelegate = nullptr; } } diff --git a/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-instances.cpp b/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-instances.cpp index de7b46d26d1c1a..dc4283539b437b 100644 --- a/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-instances.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/resource-monitoring-instances.cpp @@ -36,20 +36,7 @@ constexpr std::bitset<4> gActivatedCarbonFeatureMap{ static_cast(Featu static HepaFilterMonitoringInstance * gHepaFilterInstance = nullptr; static ActivatedCarbonFilterMonitoringInstance * gActivatedCarbonFilterInstance = nullptr; - -static ResourceMonitoring::Attributes::ReplacementProductStruct::Type sReplacementProductsList[] = { - { .productIdentifierType = ProductIdentifierTypeEnum::kUpc, - .productIdentifierValue = CharSpan::fromCharString("111112222233") }, - { .productIdentifierType = ProductIdentifierTypeEnum::kGtin8, .productIdentifierValue = CharSpan::fromCharString("gtin8xxx") }, - { .productIdentifierType = ProductIdentifierTypeEnum::kEan, - .productIdentifierValue = CharSpan::fromCharString("4444455555666") }, - { .productIdentifierType = ProductIdentifierTypeEnum::kGtin14, - .productIdentifierValue = CharSpan::fromCharString("gtin14xxxxxxxx") }, - { .productIdentifierType = ProductIdentifierTypeEnum::kOem, - .productIdentifierValue = CharSpan::fromCharString("oem20xxxxxxxxxxxxxxx") }, -}; -StaticReplacementProductListManager sReplacementProductListManager(&sReplacementProductsList[0], - ArraySize(sReplacementProductsList)); +static ImmutableReplacementProductListManager sReplacementProductListManager; //-- Activated Carbon Filter Monitoring Instance methods CHIP_ERROR ActivatedCarbonFilterMonitoringInstance::AppInit() @@ -106,14 +93,40 @@ void emberAfHepaFilterMonitoringClusterInitCallback(chip::EndpointId endpoint) gHepaFilterInstance->Init(); } -CHIP_ERROR StaticReplacementProductListManager::Next(Attributes::ReplacementProductStruct::Type & item) +CHIP_ERROR ImmutableReplacementProductListManager::Next(ReplacementProductStruct & item) { - if (mIndex < mReplacementProductListSize) + if (mIndex >= kReplacementProductListMaxSize) { - item = mReplacementProductsList[mIndex]; - mIndex++; - return CHIP_NO_ERROR; + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; } - return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + switch (mIndex) + { + case 0: { + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kUpc); + item.SetProductIdentifierValue(CharSpan::fromCharString("111112222233")); + break; + case 1: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kGtin8); + item.SetProductIdentifierValue(CharSpan::fromCharString("gtin8xxx")); + break; + case 2: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kEan); + item.SetProductIdentifierValue(CharSpan::fromCharString("4444455555666")); + break; + case 3: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kGtin14); + item.SetProductIdentifierValue(CharSpan::fromCharString("gtin14xxxxxxxx")); + break; + case 4: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kOem); + item.SetProductIdentifierValue(CharSpan::fromCharString("oem20xxxxxxxxxxxxxxx")); + break; + default: + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + break; + } + } + mIndex++; + return CHIP_NO_ERROR; } diff --git a/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp b/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp index 9a95054c26f8ab..81fa54965c2172 100644 --- a/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/rvc-modes.cpp @@ -97,7 +97,8 @@ void RvcRunMode::Shutdown() } if (gRvcRunModeDelegate != nullptr) { - gRvcRunModeDelegate->~RvcRunModeDelegate(); + delete gRvcRunModeDelegate; + gRvcRunModeDelegate = nullptr; } } @@ -180,7 +181,8 @@ void RvcCleanMode::Shutdown() } if (gRvcCleanModeDelegate != nullptr) { - gRvcCleanModeDelegate->~RvcCleanModeDelegate(); + delete gRvcCleanModeDelegate; + gRvcCleanModeDelegate = nullptr; } } diff --git a/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp b/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp index 30b8c03075e2ea..8f3c865aecaf0e 100644 --- a/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp +++ b/examples/all-clusters-app/all-clusters-common/src/tcc-mode.cpp @@ -84,7 +84,8 @@ void RefrigeratorAndTemperatureControlledCabinetMode::Shutdown() } if (gTccModeDelegate != nullptr) { - gTccModeDelegate->~TccModeDelegate(); + delete gTccModeDelegate; + gTccModeDelegate = nullptr; } } diff --git a/examples/all-clusters-app/ameba/chip_main.cmake b/examples/all-clusters-app/ameba/chip_main.cmake index 77bea5ccfe132f..9aa14765fa7923 100755 --- a/examples/all-clusters-app/ameba/chip_main.cmake +++ b/examples/all-clusters-app/ameba/chip_main.cmake @@ -298,8 +298,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/all-clusters-app/esp32/main/main.cpp b/examples/all-clusters-app/esp32/main/main.cpp index 83d6abc102701f..ecca799c81d07b 100644 --- a/examples/all-clusters-app/esp32/main/main.cpp +++ b/examples/all-clusters-app/esp32/main/main.cpp @@ -87,7 +87,7 @@ class AppCallbacks : public AppDelegate public: void OnCommissioningSessionEstablishmentStarted() {} void OnCommissioningSessionStarted() override { bluetoothLED.Set(true); } - void OnCommissioningSessionStopped(CHIP_ERROR err) override + void OnCommissioningSessionStopped() override { bluetoothLED.Set(false); pairingWindowLED.Set(false); diff --git a/examples/all-clusters-app/nrfconnect/prj.conf b/examples/all-clusters-app/nrfconnect/prj.conf index 51d5dd89c68a5f..527fae10089448 100644 --- a/examples/all-clusters-app/nrfconnect/prj.conf +++ b/examples/all-clusters-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-app/nrfconnect/prj_dfu.conf b/examples/all-clusters-app/nrfconnect/prj_dfu.conf index c0d47e635ed406..e57438bf5c1aa5 100644 --- a/examples/all-clusters-app/nrfconnect/prj_dfu.conf +++ b/examples/all-clusters-app/nrfconnect/prj_dfu.conf @@ -22,7 +22,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-app/nrfconnect/prj_release.conf b/examples/all-clusters-app/nrfconnect/prj_release.conf index b229f68b308b9d..fee661a740cccb 100644 --- a/examples/all-clusters-app/nrfconnect/prj_release.conf +++ b/examples/all-clusters-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-minimal-app/ameba/chip_main.cmake b/examples/all-clusters-minimal-app/ameba/chip_main.cmake index 95b062a636f0a6..6eed28e5dec0da 100755 --- a/examples/all-clusters-minimal-app/ameba/chip_main.cmake +++ b/examples/all-clusters-minimal-app/ameba/chip_main.cmake @@ -258,8 +258,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/all-clusters-minimal-app/esp32/main/main.cpp b/examples/all-clusters-minimal-app/esp32/main/main.cpp index 43c6faa51a2972..a673a706291a58 100644 --- a/examples/all-clusters-minimal-app/esp32/main/main.cpp +++ b/examples/all-clusters-minimal-app/esp32/main/main.cpp @@ -86,7 +86,7 @@ class AppCallbacks : public AppDelegate public: void OnCommissioningSessionEstablishmentStarted() {} void OnCommissioningSessionStarted() override { bluetoothLED.Set(true); } - void OnCommissioningSessionStopped(CHIP_ERROR err) override + void OnCommissioningSessionStopped() override { bluetoothLED.Set(false); pairingWindowLED.Set(false); diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj.conf b/examples/all-clusters-minimal-app/nrfconnect/prj.conf index c33baaa8d79761..e1613a896fd6d8 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app-minimal) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf b/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf index 6effabf6914a9b..a96c97d2517580 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-minimal-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf b/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf index 8029f55a1e31f4..7f64115af32736 100644 --- a/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf +++ b/examples/all-clusters-minimal-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # CHIP PID: 32769 == 0x8001 (all-clusters-app-minimal) CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/bridge-app/esp32/CMakeLists.txt b/examples/bridge-app/esp32/CMakeLists.txt index 1e7c544310462c..d5a5732e145274 100644 --- a/examples/bridge-app/esp32/CMakeLists.txt +++ b/examples/bridge-app/esp32/CMakeLists.txt @@ -29,7 +29,7 @@ set(EXTRA_COMPONENT_DIRS # TODO: add CHIPProjectAppConfig.h to esp32 project(chip-bridge-app) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DCHIP_HAVE_CONFIG_H;-DCHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT=16" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H;-DCHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT=16" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) # For the C3, project_include.cmake sets -Wno-format, but does not clear various # flags that depend on -Wformat diff --git a/examples/bridge-app/esp32/main/CMakeLists.txt b/examples/bridge-app/esp32/main/CMakeLists.txt index 432ce5a2dfe6cb..e2250f001799b5 100644 --- a/examples/bridge-app/esp32/main/CMakeLists.txt +++ b/examples/bridge-app/esp32/main/CMakeLists.txt @@ -58,7 +58,7 @@ include("${CHIP_ROOT}/build/chip/esp32/esp32_codegen.cmake") chip_app_component_codegen("${CHIP_ROOT}/examples/bridge-app/bridge-common/bridge-app.matter") chip_app_component_zapgen("${CHIP_ROOT}/examples/bridge-app/bridge-common/bridge-app.zap") -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") target_compile_options(${COMPONENT_LIB} PUBLIC "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" diff --git a/examples/chef/ameba/chip_main.cmake b/examples/chef/ameba/chip_main.cmake index c92f1e0b471eb0..bc4ef4a9308bc1 100755 --- a/examples/chef/ameba/chip_main.cmake +++ b/examples/chef/ameba/chip_main.cmake @@ -114,8 +114,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/chef/chef.py b/examples/chef/chef.py index 977d2775ef0ba3..aa594aef4c39fa 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -37,7 +37,7 @@ _REPO_BASE_PATH = os.path.join(_CHEF_SCRIPT_PATH, "../../") _DEVICE_FOLDER = os.path.join(_CHEF_SCRIPT_PATH, "devices") _DEVICE_LIST = [file[:-4] - for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap")] + for file in os.listdir(_DEVICE_FOLDER) if file.endswith(".zap") and file != 'template.zap'] _CICD_CONFIG_FILE_NAME = os.path.join(_CHEF_SCRIPT_PATH, "cicd_config.json") _CD_STAGING_DIR = os.path.join(_CHEF_SCRIPT_PATH, "staging") diff --git a/examples/chef/nrfconnect/prj.conf b/examples/chef/nrfconnect/prj.conf index 2f2fc49501d231..03c7e188675c95 100644 --- a/examples/chef/nrfconnect/prj.conf +++ b/examples/chef/nrfconnect/prj.conf @@ -15,7 +15,7 @@ # CONFIG_CHIP=y -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample diff --git a/examples/chef/silabs/with_pw_rpc.gni b/examples/chef/silabs/with_pw_rpc.gni index f07744d855c6f9..ec2d4cff28e7ad 100644 --- a/examples/chef/silabs/with_pw_rpc.gni +++ b/examples/chef/silabs/with_pw_rpc.gni @@ -24,7 +24,5 @@ silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true -cpp_standard = "gnu++17" - # Light app on EFR enables tracing server pw_trace_BACKEND = "$dir_pw_trace_tokenized" diff --git a/examples/chip-tool/args.gni b/examples/chip-tool/args.gni index 96dd37f02f03a1..a0b30a430f23f3 100644 --- a/examples/chip-tool/args.gni +++ b/examples/chip-tool/args.gni @@ -25,8 +25,5 @@ chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] matter_enable_tracing_support = true -# Perfetto requires C++17 -cpp_standard = "gnu++17" - matter_log_json_payload_hex = true matter_log_json_payload_decode_full = true diff --git a/examples/common/tracing/BUILD.gn b/examples/common/tracing/BUILD.gn index 57eaaca3952245..266c3fc0f31581 100644 --- a/examples/common/tracing/BUILD.gn +++ b/examples/common/tracing/BUILD.gn @@ -19,10 +19,7 @@ import("${chip_root}/build/chip/buildconfig_header.gni") import("${chip_root}/src/lib/lib.gni") declare_args() { - # TODO: cpp_standard check is not ideal, it should be >= 17, - # however for now this is what we use in compilations - matter_commandline_enable_perfetto_tracing = - current_os == "linux" && cpp_standard == "gnu++17" + matter_commandline_enable_perfetto_tracing = current_os == "linux" } config("default_config") { diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index 83adb93e91fffc..597af3c96270d8 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -35,17 +35,13 @@ "Test_TC_BINFO_2_2", "Test_TC_ACL_2_5", "Test_TC_ACL_2_6", + "Test_TC_SMOKECO_2_2", + "Test_TC_SMOKECO_2_3", + "Test_TC_SMOKECO_2_4", + "Test_TC_SMOKECO_2_5", "Disabled because the power source configuration cluster is now deprecated and not present in all-clusters", "Test_TC_PSCFG_1_1", "Test_TC_PSCFG_2_1", - "Test_TC_PSCFG_2_2", - "Disabled due to SmokeCOAlarm not being enabled in Matter.framework for now:", - "Test_TC_SMCO_1_1", - "Test_TC_SMCO_2_1", - "Test_TC_SMCO_2_2", - "Test_TC_SMCO_2_3", - "Test_TC_SMCO_2_4", - "Test_TC_SMCO_2_5", - "Test_TC_SMCO_2_6" + "Test_TC_PSCFG_2_2" ] } diff --git a/examples/light-switch-app/ameba/chip_main.cmake b/examples/light-switch-app/ameba/chip_main.cmake index 23d8d66feea2d4..71deaa9938e494 100755 --- a/examples/light-switch-app/ameba/chip_main.cmake +++ b/examples/light-switch-app/ameba/chip_main.cmake @@ -287,8 +287,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/light-switch-app/genio/with_pw_rpc.gni b/examples/light-switch-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/light-switch-app/genio/with_pw_rpc.gni +++ b/examples/light-switch-app/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/light-switch-app/nrfconnect/prj.conf b/examples/light-switch-app/nrfconnect/prj.conf index 23fa257975fe64..726846ae48cee5 100644 --- a/examples/light-switch-app/nrfconnect/prj.conf +++ b/examples/light-switch-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32772 == 0x8004 (example light-switch-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/light-switch-app/nrfconnect/prj_no_dfu.conf b/examples/light-switch-app/nrfconnect/prj_no_dfu.conf index 145cb9b50f835e..df884ba56d4300 100644 --- a/examples/light-switch-app/nrfconnect/prj_no_dfu.conf +++ b/examples/light-switch-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32772 == 0x8004 (example light-switch-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/light-switch-app/nrfconnect/prj_release.conf b/examples/light-switch-app/nrfconnect/prj_release.conf index 520a280b1e18ab..e033650db1d427 100644 --- a/examples/light-switch-app/nrfconnect/prj_release.conf +++ b/examples/light-switch-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32772 == 0x8004 (example light-switch-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32772 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/lighting-app/ameba/chip_main.cmake b/examples/lighting-app/ameba/chip_main.cmake index 5d8b85dd1e6a14..727b7e4d554868 100755 --- a/examples/lighting-app/ameba/chip_main.cmake +++ b/examples/lighting-app/ameba/chip_main.cmake @@ -274,8 +274,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni index f398cda41f8c7d..4b76ad23d426ac 100644 --- a/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni +++ b/examples/lighting-app/bouffalolab/bl602/with_pw_rpc.gni @@ -22,8 +22,6 @@ import("${chip_root}/examples/platform/bouffalolab/bl602/args.gni") chip_enable_pw_rpc = true -cpp_standard = "gnu++17" - # pigweed updated to a1bd248 makes compile conversion errors; # it seems riscv gcc (version > 10) can fixes this issue. # let's disable strict warnings for RPC enabled for now. diff --git a/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni index 0a075b0e27228c..130936065cd57c 100644 --- a/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni +++ b/examples/lighting-app/bouffalolab/bl702/with_pw_rpc.gni @@ -22,8 +22,6 @@ import("${chip_root}/examples/platform/bouffalolab/bl702/args.gni") chip_enable_pw_rpc = true -cpp_standard = "gnu++17" - # pigweed updated to a1bd248 makes compile conversion errors; # it seems riscv gcc (version > 10) can fixes this issue. # let's disable strict warnings for RPC enabled for now. diff --git a/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni b/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni index 81aacad443b43c..5d7ce27c99df3d 100644 --- a/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni +++ b/examples/lighting-app/bouffalolab/bl702l/with_pw_rpc.gni @@ -22,6 +22,4 @@ import("${chip_root}/examples/platform/bouffalolab/bl702l/args.gni") chip_enable_pw_rpc = true chip_build_pw_trace_lib = false - -cpp_standard = "gnu++17" #pw_trace_BACKEND = "$dir_pw_trace_tokenized" diff --git a/examples/lighting-app/genio/with_pw_rpc.gni b/examples/lighting-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/lighting-app/genio/with_pw_rpc.gni +++ b/examples/lighting-app/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/lighting-app/nrfconnect/prj.conf b/examples/lighting-app/nrfconnect/prj.conf index ad67f13edf08e3..3419b5b0fc7087 100644 --- a/examples/lighting-app/nrfconnect/prj.conf +++ b/examples/lighting-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32773 == 0x8005 (example lighting-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Enable CHIP pairing automatically on application start. CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/lighting-app/nrfconnect/prj_no_dfu.conf b/examples/lighting-app/nrfconnect/prj_no_dfu.conf index a2d0392c98b5a9..22cdc2b700ee9f 100644 --- a/examples/lighting-app/nrfconnect/prj_no_dfu.conf +++ b/examples/lighting-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32773 == 0x8005 (example lighting-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Enable CHIP pairing automatically on application start. CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/lighting-app/nrfconnect/prj_release.conf b/examples/lighting-app/nrfconnect/prj_release.conf index 762b6d44f919c7..1977239abf0d4b 100644 --- a/examples/lighting-app/nrfconnect/prj_release.conf +++ b/examples/lighting-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32773 == 0x8005 (example lighting-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32773 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Enable CHIP pairing automatically on application start. CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y diff --git a/examples/lighting-app/qpg/with_pw_rpc.gni b/examples/lighting-app/qpg/with_pw_rpc.gni index 2c388aa153388e..a2d2b536b17682 100644 --- a/examples/lighting-app/qpg/with_pw_rpc.gni +++ b/examples/lighting-app/qpg/with_pw_rpc.gni @@ -22,5 +22,3 @@ qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/lighting-app/silabs/with_pw_rpc.gni b/examples/lighting-app/silabs/with_pw_rpc.gni index f8af7659ce1ed8..b53832f4b3d468 100644 --- a/examples/lighting-app/silabs/with_pw_rpc.gni +++ b/examples/lighting-app/silabs/with_pw_rpc.gni @@ -25,7 +25,5 @@ app_data_model = "${chip_root}/examples/lighting-app/lighting-common" chip_enable_pw_rpc = true chip_enable_openthread = true -cpp_standard = "gnu++17" - # Light app on EFR enables tracing server pw_trace_BACKEND = "$dir_pw_trace_tokenized" diff --git a/examples/lock-app/genio/with_pw_rpc.gni b/examples/lock-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/lock-app/genio/with_pw_rpc.gni +++ b/examples/lock-app/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/lock-app/nrfconnect/prj.conf b/examples/lock-app/nrfconnect/prj.conf index 6b4864a2a486b7..3216fbc3190af9 100644 --- a/examples/lock-app/nrfconnect/prj.conf +++ b/examples/lock-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32774 == 0x8006 (example lock-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/lock-app/nrfconnect/prj_no_dfu.conf b/examples/lock-app/nrfconnect/prj_no_dfu.conf index a53431aa2dd9d7..68cd0ea04a0923 100644 --- a/examples/lock-app/nrfconnect/prj_no_dfu.conf +++ b/examples/lock-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32774 == 0x8006 (example lock-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/lock-app/nrfconnect/prj_release.conf b/examples/lock-app/nrfconnect/prj_release.conf index ba830806523ded..6f0c11ba41dd18 100644 --- a/examples/lock-app/nrfconnect/prj_release.conf +++ b/examples/lock-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32774 == 0x8006 (example lock-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32774 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/lock-app/qpg/with_pw_rpc.gni b/examples/lock-app/qpg/with_pw_rpc.gni index 60eff2c6f10c42..6f195eee957169 100644 --- a/examples/lock-app/qpg/with_pw_rpc.gni +++ b/examples/lock-app/qpg/with_pw_rpc.gni @@ -22,5 +22,3 @@ import("${chip_root}/examples/platform/qpg/args.gni") qpg_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true - -cpp_standard = "gnu++17" diff --git a/examples/lock-app/silabs/include/LockManager.h b/examples/lock-app/silabs/include/LockManager.h index fcc03abdce0f5d..901dfdbd06cb04 100644 --- a/examples/lock-app/silabs/include/LockManager.h +++ b/examples/lock-app/silabs/include/LockManager.h @@ -145,6 +145,7 @@ class LockManager bool Lock(chip::EndpointId endpointId, const Optional & pin, OperationErrorEnum & err); bool Unlock(chip::EndpointId endpointId, const Optional & pin, OperationErrorEnum & err); + bool Unbolt(chip::EndpointId endpointId, const Optional & pin, OperationErrorEnum & err); bool GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user); bool SetUser(chip::EndpointId endpointId, uint16_t userIndex, chip::FabricIndex creator, chip::FabricIndex modifier, diff --git a/examples/lock-app/silabs/src/LockManager.cpp b/examples/lock-app/silabs/src/LockManager.cpp index b66fca8ec874e6..f3c6dfe748ca35 100644 --- a/examples/lock-app/silabs/src/LockManager.cpp +++ b/examples/lock-app/silabs/src/LockManager.cpp @@ -298,6 +298,11 @@ bool LockManager::Unlock(chip::EndpointId endpointId, const Optional & pin, OperationErrorEnum & err) +{ + return setLockState(endpointId, DlLockState::kUnlocked, pin, err); +} + bool LockManager::GetUser(chip::EndpointId endpointId, uint16_t userIndex, EmberAfPluginDoorLockUserInfo & user) { VerifyOrReturnValue(userIndex > 0, false); // indices are one-indexed diff --git a/examples/lock-app/silabs/src/ZclCallbacks.cpp b/examples/lock-app/silabs/src/ZclCallbacks.cpp index 778637e250a5a5..f0316cb78fe8fc 100644 --- a/examples/lock-app/silabs/src/ZclCallbacks.cpp +++ b/examples/lock-app/silabs/src/ZclCallbacks.cpp @@ -58,7 +58,8 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & */ void emberAfDoorLockClusterInitCallback(EndpointId endpoint) {} -bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Optional & pinCode, +bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const Nullable & fabricIdx, + const Nullable & nodeId, const Optional & pinCode, OperationErrorEnum & err) { ChipLogProgress(Zcl, "Door Lock App: Lock Command endpoint=%d", endpointId); @@ -70,7 +71,8 @@ bool emberAfPluginDoorLockOnDoorLockCommand(chip::EndpointId endpointId, const O return status; } -bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Optional & pinCode, +bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const Nullable & fabricIdx, + const Nullable & nodeId, const Optional & pinCode, OperationErrorEnum & err) { ChipLogProgress(Zcl, "Door Lock App: Unlock Command endpoint=%d", endpointId); @@ -82,6 +84,20 @@ bool emberAfPluginDoorLockOnDoorUnlockCommand(chip::EndpointId endpointId, const return status; } +// TODO : Add helper function to call from the Unlock command if we establish Unbolt doesn't need a different behaviour than Unlock +bool emberAfPluginDoorLockOnDoorUnboltCommand(chip::EndpointId endpointId, const Nullable & fabricIdx, + const Nullable & nodeId, const Optional & pinCode, + OperationErrorEnum & err) +{ + ChipLogProgress(Zcl, "Door Lock App: Unbolt Command endpoint=%d", endpointId); + bool status = LockMgr().Unlock(endpointId, pinCode, err); + if (status == true) + { + LockMgr().InitiateAction(AppEvent::kEventType_Lock, LockManager::UNLOCK_ACTION); + } + + return status; +} bool emberAfPluginDoorLockGetCredential(chip::EndpointId endpointId, uint16_t credentialIndex, CredentialTypeEnum credentialType, EmberAfPluginDoorLockCredentialInfo & credential) diff --git a/examples/lock-app/silabs/with_pw_rpc.gni b/examples/lock-app/silabs/with_pw_rpc.gni index 2592790c03e2ce..c919d90189eb7c 100644 --- a/examples/lock-app/silabs/with_pw_rpc.gni +++ b/examples/lock-app/silabs/with_pw_rpc.gni @@ -26,8 +26,6 @@ chip_enable_pw_rpc = true chip_enable_openthread = true chip_openthread_ftd = true -cpp_standard = "gnu++17" - # To fit in flash chip_detail_logging = false show_qr_code = false diff --git a/examples/ota-provider-app/esp32/CMakeLists.txt b/examples/ota-provider-app/esp32/CMakeLists.txt index d9abb2fe27f3d3..156c9366e183b1 100644 --- a/examples/ota-provider-app/esp32/CMakeLists.txt +++ b/examples/ota-provider-app/esp32/CMakeLists.txt @@ -30,7 +30,7 @@ set(EXTRA_COMPONENT_DIRS ) project(chip-ota-provider-app) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) # For the C3, project_include.cmake sets -Wno-format, but does not clear various # flags that depend on -Wformat diff --git a/examples/ota-provider-app/esp32/main/CMakeLists.txt b/examples/ota-provider-app/esp32/main/CMakeLists.txt index 2572149172141a..a63033f017d8b2 100644 --- a/examples/ota-provider-app/esp32/main/CMakeLists.txt +++ b/examples/ota-provider-app/esp32/main/CMakeLists.txt @@ -62,7 +62,7 @@ chip_app_component_codegen("${CHIP_ROOT}/examples/ota-provider-app/ota-provider- chip_app_component_zapgen("${CHIP_ROOT}/examples/ota-provider-app/ota-provider-common/ota-provider-app.zap") spiffs_create_partition_image(img_storage ${CMAKE_SOURCE_DIR}/spiffs_image FLASH_IN_PROJECT) -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") target_compile_options(${COMPONENT_LIB} PUBLIC "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" diff --git a/examples/ota-requestor-app/ameba/chip_main.cmake b/examples/ota-requestor-app/ameba/chip_main.cmake index a7aecb06707370..ed14a6424eab40 100644 --- a/examples/ota-requestor-app/ameba/chip_main.cmake +++ b/examples/ota-requestor-app/ameba/chip_main.cmake @@ -91,8 +91,7 @@ list( APPEND chip_main_cpp_flags -Wno-unused-parameter - -std=gnu++11 - -std=c++14 + -std=c++17 -fno-rtti ) target_compile_definitions(${chip_main} PRIVATE ${chip_main_flags} ) diff --git a/examples/ota-requestor-app/genio/with_pw_rpc.gni b/examples/ota-requestor-app/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/ota-requestor-app/genio/with_pw_rpc.gni +++ b/examples/ota-requestor-app/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/persistent-storage/esp32/CMakeLists.txt b/examples/persistent-storage/esp32/CMakeLists.txt index 372d88c2729db1..86bf87b7a4a4d5 100644 --- a/examples/persistent-storage/esp32/CMakeLists.txt +++ b/examples/persistent-storage/esp32/CMakeLists.txt @@ -28,7 +28,7 @@ set(EXTRA_COMPONENT_DIRS ) project(chip-persistent-storage) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) # For the C3, project_include.cmake sets -Wno-format, but does not clear various # flags that depend on -Wformat diff --git a/examples/persistent-storage/esp32/main/CMakeLists.txt b/examples/persistent-storage/esp32/main/CMakeLists.txt index 2697a55dd39171..30c85accfbe36d 100644 --- a/examples/persistent-storage/esp32/main/CMakeLists.txt +++ b/examples/persistent-storage/esp32/main/CMakeLists.txt @@ -23,5 +23,5 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/examples/persistent-storage" PRIV_REQUIRES chip nvs_flash) -set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 17) target_compile_options(${COMPONENT_LIB} PRIVATE "-DCHIP_HAVE_CONFIG_H") diff --git a/examples/placeholder/linux/apps/app1/BUILD.gn b/examples/placeholder/linux/apps/app1/BUILD.gn index 595a0b7563132c..99b3547b81e7c8 100644 --- a/examples/placeholder/linux/apps/app1/BUILD.gn +++ b/examples/placeholder/linux/apps/app1/BUILD.gn @@ -30,6 +30,7 @@ source_set("app1") { ] sources = [ + "../../resource-monitoring-instances.cpp", "../../src/bridged-actions-stub.cpp", "../../static-supported-modes-manager.cpp", ] diff --git a/examples/placeholder/linux/apps/app2/BUILD.gn b/examples/placeholder/linux/apps/app2/BUILD.gn index 7d8f30a8ea83ec..91777971875d15 100644 --- a/examples/placeholder/linux/apps/app2/BUILD.gn +++ b/examples/placeholder/linux/apps/app2/BUILD.gn @@ -30,6 +30,7 @@ source_set("app2") { ] sources = [ + "../../resource-monitoring-instances.cpp", "../../src/bridged-actions-stub.cpp", "../../static-supported-modes-manager.cpp", ] diff --git a/examples/placeholder/linux/include/resource-monitoring-instances.h b/examples/placeholder/linux/include/resource-monitoring-instances.h new file mode 100644 index 00000000000000..276e423626c1d7 --- /dev/null +++ b/examples/placeholder/linux/include/resource-monitoring-instances.h @@ -0,0 +1,63 @@ +/* + * + * 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. + */ + +#include +#include +#include +#include + +/// This is an application level Instance to handle ActivatedCarbonfilterMonitoringInstance commands according to the specific +/// business logic. +class ActivatedCarbonFilterMonitoringInstance : public chip::app::Clusters::ResourceMonitoring::Instance +{ +private: + CHIP_ERROR AppInit() override; + chip::Protocols::InteractionModel::Status PreResetCondition() override; + chip::Protocols::InteractionModel::Status PostResetCondition() override; + +public: + ActivatedCarbonFilterMonitoringInstance( + chip::EndpointId aEndpointId, uint32_t aFeature, + chip::app::Clusters::ResourceMonitoring::Attributes::DegradationDirection::TypeInfo::Type aDegradationDirection, + bool aResetConditionCommandSupported) : + Instance(aEndpointId, chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id, aFeature, aDegradationDirection, + aResetConditionCommandSupported){}; +}; + +/// This is an application level instance to handle HepaFilterMonitoringInstance commands according to the specific business logic. +class HepaFilterMonitoringInstance : public chip::app::Clusters::ResourceMonitoring::Instance +{ +private: + CHIP_ERROR AppInit() override; + chip::Protocols::InteractionModel::Status PreResetCondition() override; + chip::Protocols::InteractionModel::Status PostResetCondition() override; + +public: + HepaFilterMonitoringInstance( + chip::EndpointId aEndpointId, uint32_t aFeature, + chip::app::Clusters::ResourceMonitoring::Attributes::DegradationDirection::TypeInfo::Type aDegradationDirection, + bool aResetConditionCommandSupported) : + Instance(aEndpointId, chip::app::Clusters::HepaFilterMonitoring::Id, aFeature, aDegradationDirection, + aResetConditionCommandSupported){}; +}; + +class ImmutableReplacementProductListManager : public chip::app::Clusters::ResourceMonitoring::ReplacementProductListManager +{ +public: + CHIP_ERROR + Next(chip::app::Clusters::ResourceMonitoring::ReplacementProductStruct & item) override; +}; diff --git a/examples/placeholder/linux/resource-monitoring-instances.cpp b/examples/placeholder/linux/resource-monitoring-instances.cpp new file mode 100644 index 00000000000000..a030beed78c7e6 --- /dev/null +++ b/examples/placeholder/linux/resource-monitoring-instances.cpp @@ -0,0 +1,133 @@ +/* + * + * 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. + */ + +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ResourceMonitoring; +using chip::Protocols::InteractionModel::Status; + +constexpr std::bitset<4> gHepaFilterFeatureMap{ static_cast(Feature::kCondition) | + static_cast(Feature::kWarning) | + static_cast(Feature::kReplacementProductList) }; +constexpr std::bitset<4> gActivatedCarbonFeatureMap{ static_cast(Feature::kCondition) | + static_cast(Feature::kWarning) | + static_cast(Feature::kReplacementProductList) }; + +static HepaFilterMonitoringInstance * gHepaFilterInstance = nullptr; +static ActivatedCarbonFilterMonitoringInstance * gActivatedCarbonFilterInstance = nullptr; + +static ImmutableReplacementProductListManager sReplacementProductListManager; + +//-- Activated Carbon Filter Monitoring Instance methods +CHIP_ERROR ActivatedCarbonFilterMonitoringInstance::AppInit() +{ + ChipLogDetail(Zcl, "ActivatedCarbonFilterMonitoringDelegate::Init()"); + SetReplacementProductListManagerInstance(&sReplacementProductListManager); + return CHIP_NO_ERROR; +} + +Status ActivatedCarbonFilterMonitoringInstance::PreResetCondition() +{ + ChipLogDetail(Zcl, "ActivatedCarbonFilterMonitoringInstance::PreResetCondition()"); + return Status::Success; +} + +Status ActivatedCarbonFilterMonitoringInstance::PostResetCondition() +{ + ChipLogDetail(Zcl, "ActivatedCarbonFilterMonitoringInstance::PostResetCondition()"); + return Status::Success; +} + +//-- Hepa Filter Monitoring instance methods +CHIP_ERROR HepaFilterMonitoringInstance::AppInit() +{ + ChipLogDetail(Zcl, "HepaFilterMonitoringInstance::Init()"); + SetReplacementProductListManagerInstance(&sReplacementProductListManager); + return CHIP_NO_ERROR; +} + +Status HepaFilterMonitoringInstance::PreResetCondition() +{ + ChipLogDetail(Zcl, "HepaFilterMonitoringInstance::PreResetCondition()"); + return Status::Success; +} + +Status HepaFilterMonitoringInstance::PostResetCondition() +{ + ChipLogDetail(Zcl, "HepaFilterMonitoringInstance::PostResetCondition()"); + return Status::Success; +} + +void emberAfActivatedCarbonFilterMonitoringClusterInitCallback(chip::EndpointId endpoint) +{ + VerifyOrDie(gActivatedCarbonFilterInstance == nullptr); + gActivatedCarbonFilterInstance = new ActivatedCarbonFilterMonitoringInstance( + endpoint, static_cast(gActivatedCarbonFeatureMap.to_ulong()), DegradationDirectionEnum::kDown, true); + gActivatedCarbonFilterInstance->Init(); +} +void emberAfHepaFilterMonitoringClusterInitCallback(chip::EndpointId endpoint) +{ + VerifyOrDie(gHepaFilterInstance == nullptr); + gHepaFilterInstance = new HepaFilterMonitoringInstance(endpoint, static_cast(gHepaFilterFeatureMap.to_ulong()), + DegradationDirectionEnum::kDown, true); + gHepaFilterInstance->Init(); +} + +CHIP_ERROR ImmutableReplacementProductListManager::Next(ReplacementProductStruct & item) +{ + if (mIndex >= kReplacementProductListMaxSize) + { + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + } + + switch (mIndex) + { + case 0: { + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kUpc); + item.SetProductIdentifierValue(CharSpan::fromCharString("111112222233")); + break; + case 1: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kGtin8); + item.SetProductIdentifierValue(CharSpan::fromCharString("gtin8xxx")); + break; + case 2: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kEan); + item.SetProductIdentifierValue(CharSpan::fromCharString("4444455555666")); + break; + case 3: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kGtin14); + item.SetProductIdentifierValue(CharSpan::fromCharString("gtin14xxxxxxxx")); + break; + case 4: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kOem); + item.SetProductIdentifierValue(CharSpan::fromCharString("oem20xxxxxxxxxxxxxxx")); + break; + default: + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + break; + } + } + mIndex++; + return CHIP_NO_ERROR; +} diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index cd9fe12a60a0bc..a13e84ca527cad 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -140,7 +140,7 @@ class AppCallbacks : public AppDelegate public: void OnCommissioningSessionEstablishmentStarted() {} void OnCommissioningSessionStarted() override { isComissioningStarted = true; } - void OnCommissioningSessionStopped(CHIP_ERROR err) override { isComissioningStarted = false; } + void OnCommissioningSessionStopped() override { isComissioningStarted = false; } void OnCommissioningWindowClosed() override { if (!isComissioningStarted) diff --git a/examples/pump-app/nrfconnect/prj.conf b/examples/pump-app/nrfconnect/prj.conf index 3013e7d7aec421..008a66be940be3 100644 --- a/examples/pump-app/nrfconnect/prj.conf +++ b/examples/pump-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example pump-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-app/nrfconnect/prj_no_dfu.conf b/examples/pump-app/nrfconnect/prj_no_dfu.conf index a0d3f8b1a879c2..21cd8222c2c2e2 100644 --- a/examples/pump-app/nrfconnect/prj_no_dfu.conf +++ b/examples/pump-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example pump-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-app/nrfconnect/prj_release.conf b/examples/pump-app/nrfconnect/prj_release.conf index 540c77354fa82f..fbcfe2fe16545e 100644 --- a/examples/pump-app/nrfconnect/prj_release.conf +++ b/examples/pump-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example pump-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-app/silabs/with_pw_rpc.gni b/examples/pump-app/silabs/with_pw_rpc.gni index bade7c7ea1f376..fb05fde8b4ccc3 100644 --- a/examples/pump-app/silabs/with_pw_rpc.gni +++ b/examples/pump-app/silabs/with_pw_rpc.gni @@ -26,7 +26,5 @@ chip_enable_pw_rpc = true chip_enable_openthread = true chip_build_pw_trace_lib = true -cpp_standard = "gnu++17" - # Light app on EFR enables tracing server pw_trace_BACKEND = "$dir_pw_trace_tokenized" diff --git a/examples/pump-controller-app/nrfconnect/prj.conf b/examples/pump-controller-app/nrfconnect/prj.conf index 5b9c2baff8ee9e..f8774b9f2f0f4b 100644 --- a/examples/pump-controller-app/nrfconnect/prj.conf +++ b/examples/pump-controller-app/nrfconnect/prj.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32785 == 0x8011 (example pump-controller-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf b/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf index d6632fe9172638..f4b60e647953ae 100644 --- a/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf +++ b/examples/pump-controller-app/nrfconnect/prj_no_dfu.conf @@ -24,7 +24,7 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32785 == 0x8011 (example pump-controller-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/pump-controller-app/nrfconnect/prj_release.conf b/examples/pump-controller-app/nrfconnect/prj_release.conf index fc3b092b655c8f..bd9e21dae49b03 100644 --- a/examples/pump-controller-app/nrfconnect/prj_release.conf +++ b/examples/pump-controller-app/nrfconnect/prj_release.conf @@ -24,7 +24,7 @@ CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32785 == 0x8011 (example pump-controller-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32785 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/resource-monitoring-app/linux/BUILD.gn b/examples/resource-monitoring-app/linux/BUILD.gn index c5e769a39ce4f7..e9d5e391def96c 100644 --- a/examples/resource-monitoring-app/linux/BUILD.gn +++ b/examples/resource-monitoring-app/linux/BUILD.gn @@ -30,7 +30,7 @@ config("includes") { executable("chip-resource-monitoring-app") { sources = [ - "${chip_root}/examples/resource-monitoring-app/resource-monitoring-common/src/StaticReplacementProductListManager.cpp", + "${chip_root}/examples/resource-monitoring-app/resource-monitoring-common/src/ReplacementProductListManager.cpp", "${chip_root}/examples/resource-monitoring-app/resource-monitoring-common/src/instances/ActivatedCarbonFilterMonitoring.cpp", "${chip_root}/examples/resource-monitoring-app/resource-monitoring-common/src/instances/HepaFilterMonitoring.cpp", "include/CHIPProjectAppConfig.h", diff --git a/examples/resource-monitoring-app/resource-monitoring-common/include/ImmutableReplacementProductListManager.h b/examples/resource-monitoring-app/resource-monitoring-common/include/ImmutableReplacementProductListManager.h new file mode 100644 index 00000000000000..2dcbff41372866 --- /dev/null +++ b/examples/resource-monitoring-app/resource-monitoring-common/include/ImmutableReplacementProductListManager.h @@ -0,0 +1,44 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +#pragma once + +#include +#include +#include + +namespace chip { +namespace app { +namespace Clusters { +namespace ResourceMonitoring { + +/** + * This implementation returns an immutable list of replacement products. + * It holds ReplacementProductListManager::kReplacementProductListMaxSize products in the list. + */ + +class ImmutableReplacementProductListManager : public ReplacementProductListManager +{ +public: + CHIP_ERROR Next(ReplacementProductStruct & item) override; +}; + +} // namespace ResourceMonitoring +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/resource-monitoring-app/resource-monitoring-common/include/StaticReplacementProductListManager.h b/examples/resource-monitoring-app/resource-monitoring-common/include/StaticReplacementProductListManager.h index cb83148302f8b6..26601a235fcb1d 100644 --- a/examples/resource-monitoring-app/resource-monitoring-common/include/StaticReplacementProductListManager.h +++ b/examples/resource-monitoring-app/resource-monitoring-common/include/StaticReplacementProductListManager.h @@ -34,20 +34,17 @@ namespace ResourceMonitoring { class StaticReplacementProductListManager : public ReplacementProductListManager { public: - uint8_t Size() override { return mReplacementProductListSize; }; - - CHIP_ERROR Next(Attributes::ReplacementProductStruct::Type & item) override; + CHIP_ERROR Next(ReplacementProductStruct & item) override; ~StaticReplacementProductListManager() {} - StaticReplacementProductListManager(Attributes::ReplacementProductStruct::Type * aReplacementProductsList, - uint8_t aReplacementProductListSize) + StaticReplacementProductListManager(ReplacementProductStruct * aReplacementProductsList, uint8_t aReplacementProductListSize) { mReplacementProductsList = aReplacementProductsList; mReplacementProductListSize = aReplacementProductListSize; } private: - Attributes::ReplacementProductStruct::Type * mReplacementProductsList; + ReplacementProductStruct * mReplacementProductsList; uint8_t mReplacementProductListSize; }; diff --git a/examples/resource-monitoring-app/resource-monitoring-common/src/ReplacementProductListManager.cpp b/examples/resource-monitoring-app/resource-monitoring-common/src/ReplacementProductListManager.cpp new file mode 100644 index 00000000000000..f450df6f380ef3 --- /dev/null +++ b/examples/resource-monitoring-app/resource-monitoring-common/src/ReplacementProductListManager.cpp @@ -0,0 +1,77 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * 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. + */ + +#include +#include +#include +#include +#include +#include + +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ResourceMonitoring; + +CHIP_ERROR StaticReplacementProductListManager::Next(ReplacementProductStruct & item) +{ + if (mIndex < mReplacementProductListSize) + { + item = mReplacementProductsList[mIndex]; + mIndex++; + return CHIP_NO_ERROR; + } + + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; +} + +CHIP_ERROR ImmutableReplacementProductListManager::Next(ReplacementProductStruct & item) +{ + if (mIndex >= kReplacementProductListMaxSize) + { + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + } + + switch (mIndex) + { + case 0: { + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kUpc); + item.SetProductIdentifierValue(CharSpan::fromCharString("111112222233")); + break; + case 1: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kGtin8); + item.SetProductIdentifierValue(CharSpan::fromCharString("gtin8xxx")); + break; + case 2: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kEan); + item.SetProductIdentifierValue(CharSpan::fromCharString("4444455555666")); + break; + case 3: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kGtin14); + item.SetProductIdentifierValue(CharSpan::fromCharString("gtin14xxxxxxxx")); + break; + case 4: + item.SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum::kOem); + item.SetProductIdentifierValue(CharSpan::fromCharString("oem20xxxxxxxxxxxxxxx")); + break; + default: + return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; + break; + } + } + mIndex++; + return CHIP_NO_ERROR; +} diff --git a/examples/resource-monitoring-app/resource-monitoring-common/src/StaticReplacementProductListManager.cpp b/examples/resource-monitoring-app/resource-monitoring-common/src/StaticReplacementProductListManager.cpp deleted file mode 100644 index 4c657ff05cc488..00000000000000 --- a/examples/resource-monitoring-app/resource-monitoring-common/src/StaticReplacementProductListManager.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * 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. - */ - -#include -#include -#include -#include -#include - -using namespace chip::app::Clusters; -using namespace chip::app::Clusters::ResourceMonitoring; - -CHIP_ERROR StaticReplacementProductListManager::Next(Attributes::ReplacementProductStruct::Type & item) -{ - if (mIndex < mReplacementProductListSize) - { - item = mReplacementProductsList[mIndex]; - mIndex++; - return CHIP_NO_ERROR; - } - - return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED; -} diff --git a/examples/resource-monitoring-app/resource-monitoring-common/src/instances/ActivatedCarbonFilterMonitoring.cpp b/examples/resource-monitoring-app/resource-monitoring-common/src/instances/ActivatedCarbonFilterMonitoring.cpp index 778bb9d6e22dd0..3ab33e675e02a9 100644 --- a/examples/resource-monitoring-app/resource-monitoring-common/src/instances/ActivatedCarbonFilterMonitoring.cpp +++ b/examples/resource-monitoring-app/resource-monitoring-common/src/instances/ActivatedCarbonFilterMonitoring.cpp @@ -32,19 +32,15 @@ using namespace chip; using namespace chip::app::Clusters; using namespace chip::app::Clusters::ActivatedCarbonFilterMonitoring; using namespace chip::app::Clusters::ResourceMonitoring; +using namespace chip::app::Clusters::ResourceMonitoring::Attributes; using chip::Protocols::InteractionModel::Status; -static ResourceMonitoring::Attributes::ReplacementProductStruct::Type sActivatedCarbonFilterReplacementProductsList[] = { - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kUpc, - .productIdentifierValue = CharSpan::fromCharString("111112222233") }, - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kGtin8, - .productIdentifierValue = CharSpan::fromCharString("gtin8xca") }, - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kEan, - .productIdentifierValue = CharSpan::fromCharString("4444455555666") }, - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kGtin14, - .productIdentifierValue = CharSpan::fromCharString("gtin14xcarbonx") }, - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kOem, - .productIdentifierValue = CharSpan::fromCharString("oem20xcarbonxxxxxxxx") }, +static ReplacementProductStruct sActivatedCarbonFilterReplacementProductsList[] = { + { ResourceMonitoring::ProductIdentifierTypeEnum::kUpc, CharSpan::fromCharString("111112222233") }, + { ResourceMonitoring::ProductIdentifierTypeEnum::kGtin8, CharSpan::fromCharString("gtin8xca") }, + { ResourceMonitoring::ProductIdentifierTypeEnum::kEan, CharSpan::fromCharString("4444455555666") }, + { ResourceMonitoring::ProductIdentifierTypeEnum::kGtin14, CharSpan::fromCharString("gtin14xcarbonx") }, + { ResourceMonitoring::ProductIdentifierTypeEnum::kOem, CharSpan::fromCharString("oem20xcarbonxxxxxxxx") }, }; StaticReplacementProductListManager sActivatedCarbonFilterReplacementProductListManager(&sActivatedCarbonFilterReplacementProductsList[0], diff --git a/examples/resource-monitoring-app/resource-monitoring-common/src/instances/HepafilterMonitoring.cpp b/examples/resource-monitoring-app/resource-monitoring-common/src/instances/HepafilterMonitoring.cpp index c0ee95ed7c02ff..6404f973a95097 100644 --- a/examples/resource-monitoring-app/resource-monitoring-common/src/instances/HepafilterMonitoring.cpp +++ b/examples/resource-monitoring-app/resource-monitoring-common/src/instances/HepafilterMonitoring.cpp @@ -16,7 +16,7 @@ * limitations under the License. */ -#include +#include #include #include #include @@ -31,22 +31,10 @@ using namespace chip; using namespace chip::app::Clusters; using namespace chip::app::Clusters::ResourceMonitoring; +using namespace chip::app::Clusters::ResourceMonitoring::Attributes; using chip::Protocols::InteractionModel::Status; -static ResourceMonitoring::Attributes::ReplacementProductStruct::Type sHepaFilterReplacementProductsList[] = { - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kUpc, - .productIdentifierValue = CharSpan::fromCharString("111112222233") }, - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kGtin8, - .productIdentifierValue = CharSpan::fromCharString("gtin8xhe") }, - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kEan, - .productIdentifierValue = CharSpan::fromCharString("4444455555666") }, - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kGtin14, - .productIdentifierValue = CharSpan::fromCharString("gtin14xhepaxxx") }, - { .productIdentifierType = ResourceMonitoring::ProductIdentifierTypeEnum::kOem, - .productIdentifierValue = CharSpan::fromCharString("oem20xhepaxxxxxxxxxx") }, -}; -StaticReplacementProductListManager sHepaFilterReplacementProductListManager(&sHepaFilterReplacementProductsList[0], - ArraySize(sHepaFilterReplacementProductsList)); +static ImmutableReplacementProductListManager sHepaFilterReplacementProductListManager; //-- Hepa filter Monitoring instance methods CHIP_ERROR HepaFilterMonitoringInstance::AppInit() diff --git a/examples/shell/esp32/CMakeLists.txt b/examples/shell/esp32/CMakeLists.txt index 1b1c919acef6ee..3b23f33624aeb6 100644 --- a/examples/shell/esp32/CMakeLists.txt +++ b/examples/shell/esp32/CMakeLists.txt @@ -29,7 +29,7 @@ set(EXTRA_COMPONENT_DIRS ) project(chip-shell) -idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) +idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++17;-Os;-DCHIP_HAVE_CONFIG_H" APPEND) idf_build_set_property(C_COMPILE_OPTIONS "-Os" APPEND) # For the C3, project_include.cmake sets -Wno-format, but does not clear various diff --git a/examples/shell/nrfconnect/prj.conf b/examples/shell/nrfconnect/prj.conf index c00eacaa34c0ae..4c8a3c2c95c58e 100644 --- a/examples/shell/nrfconnect/prj.conf +++ b/examples/shell/nrfconnect/prj.conf @@ -15,7 +15,7 @@ # CONFIG_CHIP=y -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # This sample uses Kconfig.defaults to set options common for all # samples. This file should contain only options specific for this sample diff --git a/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni b/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni index d06a784404a350..9b757515aceca9 100644 --- a/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni +++ b/examples/smoke-co-alarm-app/silabs/with_pw_rpc.gni @@ -25,5 +25,3 @@ app_data_model = "${chip_root}/examples/smoke-co-alarm-app/smoke-co-alarm-common" chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/thermostat/genio/with_pw_rpc.gni b/examples/thermostat/genio/with_pw_rpc.gni index 581b4f415d5654..b8fc451b7c4a3a 100644 --- a/examples/thermostat/genio/with_pw_rpc.gni +++ b/examples/thermostat/genio/with_pw_rpc.gni @@ -23,5 +23,3 @@ mt793x_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true chip_enable_openthread = true - -cpp_standard = "gnu++17" diff --git a/examples/window-app/nrfconnect/prj.conf b/examples/window-app/nrfconnect/prj.conf index 0f941b5aa1e6e8..052d3fbe841572 100644 --- a/examples/window-app/nrfconnect/prj.conf +++ b/examples/window-app/nrfconnect/prj.conf @@ -19,7 +19,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example window-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/window-app/nrfconnect/prj_no_dfu.conf b/examples/window-app/nrfconnect/prj_no_dfu.conf index b6caf7b75454e1..3183a0e518ac47 100644 --- a/examples/window-app/nrfconnect/prj_no_dfu.conf +++ b/examples/window-app/nrfconnect/prj_no_dfu.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example window-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/examples/window-app/nrfconnect/prj_release.conf b/examples/window-app/nrfconnect/prj_release.conf index bcf59cd9e35879..f2393649c1fe0c 100644 --- a/examples/window-app/nrfconnect/prj_release.conf +++ b/examples/window-app/nrfconnect/prj_release.conf @@ -23,7 +23,7 @@ CONFIG_CHIP=y CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" # 32784 == 0x8010 (example window-app) CONFIG_CHIP_DEVICE_PRODUCT_ID=32784 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # Add support for LEDs and buttons on Nordic development kits CONFIG_DK_LIBRARY=y diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index 7e750750f5f76a..4ec78c51730b1a 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -16,8 +16,9 @@ steps: env: - PW_ENVIRONMENT_ROOT=/pwenv args: - - ./examples/chef/chef.py --build_all --keep_going --build_exclude - noip + - >- + perl -i -pe 's/^gdbgui==/# gdbgui==/' /opt/espressif/esp-idf/requirements.txt && + ./examples/chef/chef.py --build_all --build_exclude noip id: CompileAll waitFor: - Bootstrap @@ -30,7 +31,7 @@ steps: env: - PW_ENVIRONMENT_ROOT=/pwenv args: - - ./examples/chef/chef.py --build_all --keep_going --build_include + - ./examples/chef/chef.py --build_all --build_include linux_arm64_ipv6only.*noip id: CompileNoip waitFor: diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index 05511e2b184670..a745ee172004cc 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -32,7 +32,7 @@ steps: ./scripts/build/build_examples.py --enable-flashbundle --target esp32-devkitc-light-rpc --target esp32-m5stack-all-clusters-ipv6only --target - esp32-m5stack-all-clusters-rpc --target + esp32-m5stack-all-clusters-rpc-ipv6only --target esp32-m5stack-light --target esp32-m5stack-light-ipv6only --target esp32-m5stack-ota-requestor build --create-archives diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index 26aed1ddc34138..2b761d95684baf 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -143,11 +143,11 @@ def _GetInDevelopmentTests() -> Set[str]: "Test_TC_PSCFG_1_1.yaml", # Power source configuration cluster is deprecated and removed from all-clusters "Test_TC_PSCFG_2_1.yaml", # Power source configuration cluster is deprecated and removed from all-clusters "Test_TC_PSCFG_2_2.yaml", # Power source configuration cluster is deprecated and removed from all-clusters - "Test_TC_SMCO_2_2.yaml", # chip-repl does not support timeout (07/20/2023) - "Test_TC_SMCO_2_3.yaml", # chip-repl does not support timeout (07/20/2023) - "Test_TC_SMCO_2_4.yaml", # chip-repl does not support timeout (07/20/2023) - "Test_TC_SMCO_2_5.yaml", # chip-repl does not support timeout (07/20/2023) - "Test_TC_SMCO_2_6.yaml", # chip-repl does not support timeout (07/20/2023) + "Test_TC_SMOKECO_2_2.yaml", # chip-repl does not support local timeout (07/20/2023) + "Test_TC_SMOKECO_2_3.yaml", # chip-repl does not support local timeout (07/20/2023) + "Test_TC_SMOKECO_2_4.yaml", # chip-repl does not support local timeout (07/20/2023) + "Test_TC_SMOKECO_2_5.yaml", # chip-repl does not support local timeout (07/20/2023) + "Test_TC_SMOKECO_2_6.yaml", # chip-repl does not support local timeout (07/20/2023) "Test_TC_IDM_1_2.yaml", # chip-repl does not support AnyCommands (19/07/2023) } diff --git a/scripts/tests/yaml/chiptool.py b/scripts/tests/yaml/chiptool.py index f36e29f22e0e4b..757d304312d77b 100755 --- a/scripts/tests/yaml/chiptool.py +++ b/scripts/tests/yaml/chiptool.py @@ -32,8 +32,9 @@ @click.pass_context -def send_yaml_command(ctx, test_name: str, server_path: str, server_arguments: str, pics: str, additional_pseudo_clusters_directory: str, commands: List[str]): - kwargs = {'test_name': test_name, 'pics': pics, 'additional_pseudo_clusters_directory': additional_pseudo_clusters_directory} +def send_yaml_command(ctx, test_name: str, server_path: str, server_arguments: str, show_adapter_logs: bool, pics: str, additional_pseudo_clusters_directory: str, commands: List[str]): + kwargs = {'test_name': test_name, 'show_adapter_logs': show_adapter_logs, 'pics': pics, + 'additional_pseudo_clusters_directory': additional_pseudo_clusters_directory} index = 0 while len(commands) - index > 1: @@ -83,6 +84,8 @@ def chiptool_runner_options(f): help='Name of a websocket server to run at launch.')(f) f = click.option('--server_arguments', type=str, default='interactive server', help='Optional arguments to pass to the websocket server at launch.')(f) + f = click.option('--show_adapter_logs', type=bool, default=False, show_default=True, + help='Show additional logs provided by the adapter.')(f) f = click.option('--trace_file', type=click.Path(), default=None, help='Optional file path to save the tracing output to.')(f) f = click.option('--trace_decode', type=bool, default=True, @@ -126,14 +129,14 @@ def maybe_update_stop_on_error(ctx): @click.argument('commands', nargs=-1) @chiptool_runner_options @click.pass_context -def chiptool_py(ctx, commands: List[str], server_path: str, server_name: str, server_arguments: str, trace_file: str, trace_decode: bool, delay_in_ms: int, continueonfailure: bool, pics: str, additional_pseudo_clusters_directory: str): +def chiptool_py(ctx, commands: List[str], server_path: str, server_name: str, server_arguments: str, show_adapter_logs: bool, trace_file: str, trace_decode: bool, delay_in_ms: int, continueonfailure: bool, pics: str, additional_pseudo_clusters_directory: str): success = False server_arguments = maybe_update_server_arguments(ctx) maybe_update_stop_on_error(ctx) if len(commands) > 1 and commands[0] == 'tests': - success = send_yaml_command(commands[1], server_path, server_arguments, pics, + success = send_yaml_command(commands[1], server_path, server_arguments, show_adapter_logs, pics, additional_pseudo_clusters_directory, commands[2:]) else: if server_path is None and server_name: diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index 23b57df99ddbcf..c9df6638b708ef 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -1186,7 +1186,12 @@ CHIP_ERROR ReadClient::GetMinEventNumber(const ReadPrepareParams & aReadPrepareP } else { - return mpCallback.GetHighestReceivedEventNumber(aEventMin); + ReturnErrorOnFailure(mpCallback.GetHighestReceivedEventNumber(aEventMin)); + if (aEventMin.HasValue()) + { + // We want to start with the first event _after_ the last one we received. + aEventMin.SetValue(aEventMin.Value() + 1); + } } return CHIP_NO_ERROR; } diff --git a/src/app/clusters/mode-base-server/mode-base-server.h b/src/app/clusters/mode-base-server/mode-base-server.h index 3e1b77bcbf7e2a..b75eeb85e67481 100644 --- a/src/app/clusters/mode-base-server/mode-base-server.h +++ b/src/app/clusters/mode-base-server/mode-base-server.h @@ -241,7 +241,7 @@ class Delegate // todo change once there is a clear public interface for the OnOff cluster data dependencies (#27508) static IntrusiveList gModeBaseAliasesInstances; -// This does not return a refernce to const IntrusiveList, because the caller might need +// This does not return a reference to const IntrusiveList, because the caller might need // to change the state of the instances in the list and const IntrusiveList only allows // access to const Instance. IntrusiveList & GetModeBaseInstanceList(); diff --git a/src/app/clusters/operational-state-server/operational-state-delegate.h b/src/app/clusters/operational-state-server/operational-state-delegate.h index 6fd29bd7d48480..34bbe2d1ba10c0 100644 --- a/src/app/clusters/operational-state-server/operational-state-delegate.h +++ b/src/app/clusters/operational-state-server/operational-state-delegate.h @@ -187,21 +187,6 @@ struct GenericOperationalPhase char mPhaseNameBuffer[kOperationalPhaseNameMaxSize]; }; -/** - * A class which represents the operational completion of an Operational State cluster derivation instance. - */ -struct GenericOperationCompletion : public app::Clusters::OperationalState::Events::OperationCompletion::Type -{ - GenericOperationCompletion(uint8_t aCompletionErrorCode, - const Optional> & aTotalOperationalTime = NullOptional, - const Optional> & aPausedTime = NullOptional) - { - completionErrorCode = aCompletionErrorCode; - totalOperationalTime = aTotalOperationalTime; - pausedTime = aPausedTime; - } -}; - /** * A delegate to handle application logic of the Operational State aliased Cluster. * The delegate API assumes there will be separate delegate objects for each cluster instance. diff --git a/src/app/clusters/operational-state-server/operational-state-server.cpp b/src/app/clusters/operational-state-server/operational-state-server.cpp index a91f13d2f257a5..5fa7473f0e1641 100644 --- a/src/app/clusters/operational-state-server/operational-state-server.cpp +++ b/src/app/clusters/operational-state-server/operational-state-server.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -46,6 +45,55 @@ using namespace chip::app::Clusters::OperationalState::Attributes; using Status = Protocols::InteractionModel::Status; +/** + * A class which represents the operational error event of an Operational State cluster derivation instance. + */ +class GenericErrorEvent : private app::Clusters::OperationalState::Events::OperationalError::Type +{ + using super = app::Clusters::OperationalState::Events::OperationalError::Type; + +public: + GenericErrorEvent(ClusterId aClusterId, const Structs::ErrorStateStruct::Type & aError) : mClusterId(aClusterId) + { + errorState = aError; + } + using super::GetEventId; + using super::GetPriorityLevel; + ClusterId GetClusterId() const { return mClusterId; } + using super::Encode; + using super::kIsFabricScoped; + +private: + ClusterId mClusterId; +}; + +/** + * A class which represents the operational completion event of an Operational State cluster derivation instance. + */ +class GenericOperationCompletionEvent : private app::Clusters::OperationalState::Events::OperationCompletion::Type +{ + using super = app::Clusters::OperationalState::Events::OperationCompletion::Type; + +public: + GenericOperationCompletionEvent(ClusterId aClusterId, uint8_t aCompletionErrorCode, + const Optional> & aTotalOperationalTime = NullOptional, + const Optional> & aPausedTime = NullOptional) : + mClusterId(aClusterId) + { + completionErrorCode = aCompletionErrorCode; + totalOperationalTime = aTotalOperationalTime; + pausedTime = aPausedTime; + } + using super::GetEventId; + using super::GetPriorityLevel; + ClusterId GetClusterId() const { return mClusterId; } + using super::Encode; + using super::kIsFabricScoped; + +private: + ClusterId mClusterId; +}; + CHIP_ERROR OperationalStateServer::Init() { // Check if the cluster has been selected in zap @@ -302,44 +350,34 @@ CHIP_ERROR OperationalStateServer::Read(const ConcreteReadAttributePath & aPath, return CHIP_NO_ERROR; } -void OperationalStateServer::OnOperationalErrorDetect(const Structs::ErrorStateStruct::Type & aError) +void OperationalStateServer::OnOperationalErrorDetected(const Structs::ErrorStateStruct::Type & aError) { - ChipLogDetail(Zcl, "OperationalStateServer: OnOperationalErrorDetect"); - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, OperationalState::Attributes::OperationalState::Id); + ChipLogDetail(Zcl, "OperationalStateServer: OnOperationalErrorDetected"); + MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, Attributes::OperationalState::Id); + GenericErrorEvent event(mClusterId, aError); EventNumber eventNumber; - Events::OperationalError::Type event{ aError }; - EventLogger eventData(event); - ConcreteEventPath path(mEndpointId, mClusterId, event.GetEventId()); - EventManagement & logMgmt = chip::app::EventManagement::GetInstance(); - EventOptions eventOptions; - eventOptions.mPath = path; - eventOptions.mPriority = event.GetPriorityLevel(); - - CHIP_ERROR err = logMgmt.LogEvent(&eventData, eventOptions, eventNumber); - if (err != CHIP_NO_ERROR) + CHIP_ERROR error = app::LogEvent(event, mEndpointId, eventNumber); + + if (error != CHIP_NO_ERROR) { - ChipLogError(Zcl, "OperationalStateServer: Failed to record OperationalError event: %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(Zcl, "OperationalStateServer: Failed to record OperationalError event: %" CHIP_ERROR_FORMAT, error.Format()); } } -void OperationalStateServer::OnOperationCompletionDetect(const Events::OperationCompletion::Type & aEvent) +void OperationalStateServer::OnOperationCompletionDetected(uint8_t aCompletionErrorCode, + const Optional> & aTotalOperationalTime, + const Optional> & aPausedTime) { - ChipLogDetail(Zcl, "OperationalStateServer: OnOperationCompletionDetect"); - MatterReportingAttributeChangeCallback(mEndpointId, mClusterId, OperationalState::Attributes::OperationalState::Id); + ChipLogDetail(Zcl, "OperationalStateServer: OnOperationCompletionDetected"); + GenericOperationCompletionEvent event(mClusterId, aCompletionErrorCode, aTotalOperationalTime, aPausedTime); EventNumber eventNumber; - EventLogger eventData(aEvent); - ConcreteEventPath path(mEndpointId, mClusterId, aEvent.GetEventId()); - EventManagement & logMgmt = chip::app::EventManagement::GetInstance(); - EventOptions eventOptions; - eventOptions.mPath = path; - eventOptions.mPriority = aEvent.GetPriorityLevel(); - - CHIP_ERROR err = logMgmt.LogEvent(&eventData, eventOptions, eventNumber); - if (err != CHIP_NO_ERROR) + CHIP_ERROR error = app::LogEvent(event, mEndpointId, eventNumber); + + if (error != CHIP_NO_ERROR) { - ChipLogError(Zcl, "OperationalStateServer: Failed to record OnOperationCompletionDetect event: %" CHIP_ERROR_FORMAT, - err.Format()); + ChipLogError(Zcl, "OperationalStateServer: Failed to record OperationCompletion event: %" CHIP_ERROR_FORMAT, + error.Format()); } } diff --git a/src/app/clusters/operational-state-server/operational-state-server.h b/src/app/clusters/operational-state-server/operational-state-server.h index 796fa4cc3640e4..5bb50d3b5df6ef 100644 --- a/src/app/clusters/operational-state-server/operational-state-server.h +++ b/src/app/clusters/operational-state-server/operational-state-server.h @@ -64,13 +64,17 @@ class OperationalStateServer : public CommandHandlerInterface, public AttributeA * @brief Called when the Node detects a OperationalError has been raised. * @param aError OperationalError which detects */ - void OnOperationalErrorDetect(const Structs::ErrorStateStruct::Type & aError); + void OnOperationalErrorDetected(const Structs::ErrorStateStruct::Type & aError); /** * @brief Called when the Node detects a OperationCompletion has been raised. - * @param aEvent OperationCompletion event + * @param aCompletionErrorCode CompletionErrorCode + * @param aTotalOperationalTime TotalOperationalTime + * @param aPausedTime PausedTime */ - void OnOperationCompletionDetect(const Events::OperationCompletion::Type & aEvent); + void OnOperationCompletionDetected(uint8_t aCompletionErrorCode, + const Optional> & aTotalOperationalTime = NullOptional, + const Optional> & aPausedTime = NullOptional); /** * Creates an operational state cluster instance. The Init() function needs to be called for this instance to be registered and diff --git a/src/app/clusters/resource-monitoring-server/replacement-product-list-manager.h b/src/app/clusters/resource-monitoring-server/replacement-product-list-manager.h index b252597306c21a..bd63dabca180c9 100644 --- a/src/app/clusters/resource-monitoring-server/replacement-product-list-manager.h +++ b/src/app/clusters/resource-monitoring-server/replacement-product-list-manager.h @@ -34,15 +34,24 @@ namespace ResourceMonitoring { class ReplacementProductListManager { public: + // The max replacement product list size as defined in the specification + static constexpr size_t kReplacementProductListMaxSize = 5u; + ReplacementProductListManager() {} virtual ~ReplacementProductListManager() = default; void Reset() { mIndex = 0; } - // Returns total size of Replacement Products List. - virtual uint8_t Size() = 0; - - virtual CHIP_ERROR Next(Attributes::ReplacementProductStruct::Type & item) = 0; + /** + * Iterates through the entries in the ReplacementProductListManager. Each call to this function copies the next item into + * the out param. Calls to this function will return CHIP_NO_ERROR if there are still valid elements in the list. The function + * will return CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the end of the list has been reached. + * + * @param[out] item An out parameter that has a copy of the item retrieved in the list. + * @return CHIP_NO_ERROR if the pointer to the list element has moved to the next element and there are still valid remaining + * entries in the list. Otherwise returns CHIP_ERROR_PROVIDER_LIST_EXHAUSTED if the list has hit the last element. + */ + virtual CHIP_ERROR Next(ReplacementProductStruct & item) = 0; protected: uint8_t mIndex; diff --git a/src/app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.cpp b/src/app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.cpp index 932c95ce3a77ee..34388cba90c4d9 100644 --- a/src/app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.cpp +++ b/src/app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.cpp @@ -44,22 +44,6 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } // namespace ResetCondition. } // namespace Commands -namespace Attributes { -namespace ReplacementProductStruct { - -CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const -{ - TLV::TLVType outer; - ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kProductIdentifierType), productIdentifierType)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kProductIdentifierValue), productIdentifierValue)); - ReturnErrorOnFailure(writer.EndContainer(outer)); - return CHIP_NO_ERROR; -} - -} // namespace ReplacementProductStruct -} // namespace Attributes - } // namespace ResourceMonitoring } // namespace Clusters } // namespace app diff --git a/src/app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.h b/src/app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.h index 995f42b6dc4d7c..970a85c957bdf3 100644 --- a/src/app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.h +++ b/src/app/clusters/resource-monitoring-server/resource-monitoring-cluster-objects.h @@ -29,7 +29,9 @@ namespace app { namespace Clusters { namespace ResourceMonitoring { -static constexpr std::array AliasedClusters = { HepaFilterMonitoring::Id, ActivatedCarbonFilterMonitoring::Id }; +// max of 20 characters as defined by the constraint on the ProductIdentifierValue in the specification +static constexpr size_t kProductIdentifierValueMaxNameLength = 20u; +static constexpr std::array AliasedClusters = { HepaFilterMonitoring::Id, ActivatedCarbonFilterMonitoring::Id }; // Enum for ChangeIndicationEnum enum class ChangeIndicationEnum : uint8_t @@ -74,6 +76,74 @@ enum class ProductIdentifierTypeEnum : uint8_t kOem = 0x04 }; +// A struct used during reads of the ReplacementProductList to store a single list instance we request +// from the application. +// +// Inherit from an auto-generated struct to pick up the implementation bits, but make +// it private inheritance so people can't accidentally use this struct where the other +// is expected. +struct ReplacementProductStruct : private HepaFilterMonitoring::Structs::ReplacementProductStruct::Type +{ +private: + char productIdentifierValueBuffer[kProductIdentifierValueMaxNameLength]; + +public: + static constexpr bool kIsFabricScoped = false; + virtual ~ReplacementProductStruct() = default; + ReplacementProductStruct() {} + ReplacementProductStruct(ResourceMonitoring::ProductIdentifierTypeEnum aProductIdentifierType, + chip::CharSpan aProductIdentifierValue) + { + SetProductIdentifierType(aProductIdentifierType); + SetProductIdentifierValue(aProductIdentifierValue); + } + + ReplacementProductStruct & operator=(const ReplacementProductStruct & aReplacementProductStruct) + { + SetProductIdentifierType(aReplacementProductStruct.GetProductIdentifierType()); + SetProductIdentifierValue(aReplacementProductStruct.GetProductIdentifierValue()); + return *this; + } + + using HepaFilterMonitoring::Structs::ReplacementProductStruct::Type::Encode; + + /** + * Sets the product identifier type. + * + * @param aProductIdentifierType The product identifier type. + */ + void SetProductIdentifierType(ResourceMonitoring::ProductIdentifierTypeEnum aProductIdentifierType) + { + productIdentifierType = static_cast(aProductIdentifierType); + } + + /** + * Sets the product identifier value. + * This implementation will copy the argument into this struct's buffer. + * + * @param aProductIdentifierValue The value of the product identifier to set. + * @return CHIP_ERROR_INVALID_ARGUMENT when aProductIdentifierValue is invalid + * or the size exceeds kProductIdentifierValueMaxNameLength, returns CHIP_NO_ERROR + * otherwise. + */ + CHIP_ERROR SetProductIdentifierValue(chip::CharSpan aProductIdentifierValue) + { + VerifyOrReturnError(IsSpanUsable(aProductIdentifierValue), CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(aProductIdentifierValue.size() <= sizeof(productIdentifierValueBuffer), CHIP_ERROR_INVALID_ARGUMENT); + + memcpy(productIdentifierValueBuffer, aProductIdentifierValue.data(), aProductIdentifierValue.size()); + productIdentifierValue = CharSpan(productIdentifierValueBuffer, aProductIdentifierValue.size()); + + return CHIP_NO_ERROR; + } + + ProductIdentifierTypeEnum GetProductIdentifierType() const + { + return static_cast(productIdentifierType); + }; + chip::CharSpan GetProductIdentifierValue() const { return productIdentifierValue; }; +}; + namespace Attributes { namespace Condition { @@ -141,42 +211,9 @@ struct TypeInfo }; } // namespace LastChangedTime -namespace ReplacementProductStruct { -enum class Fields : uint8_t -{ - kProductIdentifierType = 0, - kProductIdentifierValue = 1, -}; - -struct Type -{ -public: - ProductIdentifierTypeEnum productIdentifierType = static_cast(0); - chip::CharSpan productIdentifierValue; - - CHIP_ERROR Decode(TLV::TLVReader & reader); - - static constexpr bool kIsFabricScoped = false; - - CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; -}; - -using DecodableType = Type; - -} // namespace ReplacementProductStruct - namespace ReplacementProductList { static constexpr AttributeId Id = 0x00000005; -struct TypeInfo -{ - using Type = chip::app::DataModel::List; - using DecodableType = chip::app::DataModel::DecodableList; - using DecodableArgType = const chip::app::DataModel::DecodableList &; - - static constexpr AttributeId GetAttributeId() { return Attributes::ReplacementProductList::Id; } - static constexpr bool MustUseTimedWrite() { return false; } -}; -} // namespace ReplacementProductList +} namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; diff --git a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp index 2cbcb433a23f42..c5687467d00ca0 100644 --- a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp +++ b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp @@ -244,10 +244,10 @@ CHIP_ERROR Instance::EnumerateAcceptedCommands(const ConcreteClusterPath & clust CHIP_ERROR Instance::ReadReplacableProductList(AttributeValueEncoder & aEncoder) { - CHIP_ERROR err; - if (Instance::HasFeature(ResourceMonitoring::Feature::kReplacementProductList)) + CHIP_ERROR err = CHIP_NO_ERROR; + if (HasFeature(ResourceMonitoring::Feature::kReplacementProductList)) { - ReplacementProductListManager * productListManagerInstance = Instance::GetReplacementProductListManagerInstance(); + ReplacementProductListManager * productListManagerInstance = GetReplacementProductListManagerInstance(); if (nullptr == productListManagerInstance) { aEncoder.EncodeEmptyList(); @@ -256,16 +256,19 @@ CHIP_ERROR Instance::ReadReplacableProductList(AttributeValueEncoder & aEncoder) productListManagerInstance->Reset(); - err = aEncoder.EncodeList([&](const auto & encoder) -> CHIP_ERROR { - Attributes::ReplacementProductStruct::Type replacementProductStruct; - while (productListManagerInstance->Next(replacementProductStruct) == CHIP_NO_ERROR) + err = aEncoder.EncodeList([productListManagerInstance](const auto & encoder) -> CHIP_ERROR { + ReplacementProductStruct replacementProductStruct; + CHIP_ERROR iteratorError = productListManagerInstance->Next(replacementProductStruct); + + while (CHIP_NO_ERROR == iteratorError) { ReturnErrorOnFailure(encoder.Encode(replacementProductStruct)); + iteratorError = productListManagerInstance->Next(replacementProductStruct); } - return CHIP_NO_ERROR; + return (CHIP_ERROR_PROVIDER_LIST_EXHAUSTED == iteratorError) ? CHIP_NO_ERROR : iteratorError; }); } - return CHIP_NO_ERROR; + return err; } // Implements the read functionality for non-standard attributes. diff --git a/src/app/icd/ICDManager.cpp b/src/app/icd/ICDManager.cpp index f400a7e5801087..853fd044d36732 100644 --- a/src/app/icd/ICDManager.cpp +++ b/src/app/icd/ICDManager.cpp @@ -28,6 +28,11 @@ #include #include +#ifndef ICD_ENFORCE_SIT_SLOW_POLL_LIMIT +// Set to 1 to enforce SIT Slow Polling Max value to 15seconds (spec 9.16.1.5) +#define ICD_ENFORCE_SIT_SLOW_POLL_LIMIT 0 +#endif + namespace chip { namespace app { @@ -93,6 +98,13 @@ void ICDManager::UpdateIcdMode() } } mICDMode = tempMode; + + // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. + if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) + { + ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32 " seconds", + (GetSITPollingThreshold().count() / 1000)); + } } void ICDManager::UpdateOperationState(OperationalState state) @@ -108,14 +120,14 @@ void ICDManager::UpdateOperationState(OperationalState state) DeviceLayer::SystemLayer().StartTimer(System::Clock::Timeout(idleModeInterval), OnIdleModeDone, this); System::Clock::Milliseconds32 slowPollInterval = GetSlowPollingInterval(); + +#if ICD_ENFORCE_SIT_SLOW_POLL_LIMIT // When in SIT mode, the slow poll interval SHOULDN'T be greater than the SIT mode polling threshold, per spec. - if (mICDMode == ICDMode::SIT && slowPollInterval > GetSITPollingThreshold()) + if (mICDMode == ICDMode::SIT && GetSlowPollingInterval() > GetSITPollingThreshold()) { - ChipLogDetail(AppServer, "The Slow Polling Interval of an ICD in SIT mode should be <= %" PRIu32, - (GetSITPollingThreshold().count() / 1000)); - // TODO Spec to define this conformance as a SHALL - // slowPollInterval = GetSITPollingThreshold(); + slowPollInterval = GetSITPollingThreshold(); } +#endif CHIP_ERROR err = DeviceLayer::ConnectivityMgr().SetPollingInterval(slowPollInterval); if (err != CHIP_NO_ERROR) diff --git a/src/app/server/AppDelegate.h b/src/app/server/AppDelegate.h index 24dcf2e3a92ec5..78aafd578ecb75 100644 --- a/src/app/server/AppDelegate.h +++ b/src/app/server/AppDelegate.h @@ -29,14 +29,33 @@ class AppDelegate public: virtual ~AppDelegate() {} /** - * This is called on start of session establishment process + * This is called when the PBKDFParamRequest is received and indicates the start of the session establishment process */ virtual void OnCommissioningSessionEstablishmentStarted() {} + + /** + * This is called when the commissioning session has been established + */ virtual void OnCommissioningSessionStarted() {} - virtual void OnCommissioningSessionStopped(CHIP_ERROR err) {} + + /** + * This is called when the PASE establishment failed (such as, when an invalid passcode is provided) or PASE was established + * fine but then the fail-safe expired (including being expired by the commissioner) + * + * @param err CHIP_ERROR indicating the error that occurred during session establishment or the error accompanying the fail-safe + * timeout. + */ + virtual void OnCommissioningSessionEstablishmentError(CHIP_ERROR err) {} + + /** + * This is called when the PASE establishment failed or PASE was established fine but then the fail-safe expired (including + * being expired by the commissioner) AND the commissioning window is closed. The window may be closed because the commissioning + * attempts limit was reached or advertising/listening for PASE failed. + */ + virtual void OnCommissioningSessionStopped() {} /* - * This is called anytime a basic or enhanced commissioning window is opened. + * This is called any time a basic or enhanced commissioning window is opened. * * The type of the window can be retrieved by calling * CommissioningWindowManager::CommissioningWindowStatusForCluster(), but @@ -44,5 +63,9 @@ class AppDelegate * fact open. */ virtual void OnCommissioningWindowOpened() {} + + /* + * This is called any time a basic or enhanced commissioning window is closed. + */ virtual void OnCommissioningWindowClosed() {} }; diff --git a/src/app/server/CommissioningWindowManager.cpp b/src/app/server/CommissioningWindowManager.cpp index b8fb6a54e6e629..a8c6fe1cea462c 100644 --- a/src/app/server/CommissioningWindowManager.cpp +++ b/src/app/server/CommissioningWindowManager.cpp @@ -129,6 +129,8 @@ void CommissioningWindowManager::ResetState() DeviceLayer::SystemLayer().CancelTimer(HandleCommissioningWindowTimeout, this); mCommissioningTimeoutTimerArmed = false; + + DeviceLayer::PlatformMgr().RemoveEventHandler(OnPlatformEventWrapper, reinterpret_cast(this)); } void CommissioningWindowManager::Cleanup() @@ -150,6 +152,8 @@ void CommissioningWindowManager::HandleFailedAttempt(CHIP_ERROR err) #if CONFIG_NETWORK_LAYER_BLE mServer->GetBleLayerObject()->CloseAllBleConnections(); #endif + + CHIP_ERROR prevErr = err; if (mFailedCommissioningAttempts < kMaxFailedCommissioningAttempts) { // If the number of commissioning attempts has not exceeded maximum @@ -157,6 +161,11 @@ void CommissioningWindowManager::HandleFailedAttempt(CHIP_ERROR err) err = AdvertiseAndListenForPASE(); } + if (mAppDelegate != nullptr) + { + mAppDelegate->OnCommissioningSessionEstablishmentError(prevErr); + } + if (err != CHIP_NO_ERROR) { // The commissioning attempts limit was exceeded, or listening for @@ -165,7 +174,7 @@ void CommissioningWindowManager::HandleFailedAttempt(CHIP_ERROR err) if (mAppDelegate != nullptr) { - mAppDelegate->OnCommissioningSessionStopped(err); + mAppDelegate->OnCommissioningSessionStopped(); } } } diff --git a/src/app/tests/TestOperationalStateDelegate.cpp b/src/app/tests/TestOperationalStateDelegate.cpp index a4d5dce822bc8d..e82f80bbdaff84 100644 --- a/src/app/tests/TestOperationalStateDelegate.cpp +++ b/src/app/tests/TestOperationalStateDelegate.cpp @@ -542,42 +542,6 @@ void TestStructGenericOperationalPhaseCopyAssignment(nlTestSuite * inSuite, void memcmp(const_cast(phase.mPhaseName.Value().data()), phaseBuffer2, kOperationalPhaseNameMaxSize) == 0); } -void TestStructGenericOperationalCompletionConstructor(nlTestSuite * inSuite, void * inContext) -{ - using namespace chip::app; - using namespace chip::app::Clusters::OperationalState; - - // completion with only CompletionErrorCode - GenericOperationCompletion genericOperationCompletion(to_underlying(OperationalStateEnum::kError)); - NL_TEST_ASSERT(inSuite, genericOperationCompletion.completionErrorCode == to_underlying(OperationalStateEnum::kError)); - NL_TEST_ASSERT(inSuite, genericOperationCompletion.totalOperationalTime.HasValue() == false); - NL_TEST_ASSERT(inSuite, genericOperationCompletion.pausedTime.HasValue() == false); - - // completion with errorCode and TotalOperationalTime - uint32_t kTotalOperationalTime = 500; - GenericOperationCompletion genericOperationCompletion2( - to_underlying(OperationalStateEnum::kError), - Optional>(DataModel::Nullable(kTotalOperationalTime))); - NL_TEST_ASSERT(inSuite, genericOperationCompletion2.completionErrorCode == to_underlying(OperationalStateEnum::kError)); - - NL_TEST_ASSERT(inSuite, genericOperationCompletion2.totalOperationalTime.HasValue() == true); - NL_TEST_ASSERT(inSuite, genericOperationCompletion2.totalOperationalTime.Value().Value() == kTotalOperationalTime); - NL_TEST_ASSERT(inSuite, genericOperationCompletion2.pausedTime.HasValue() == false); - - // completion with errorCode, TotalOperationalTime and PausedTime - uint32_t kPausedTime = 2000; - GenericOperationCompletion genericOperationCompletion3( - to_underlying(OperationalStateEnum::kError), - Optional>(DataModel::Nullable(kTotalOperationalTime)), - Optional>(DataModel::Nullable(kPausedTime))); - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.completionErrorCode == to_underlying(OperationalStateEnum::kError)); - - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.totalOperationalTime.HasValue() == true); - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.totalOperationalTime.Value().Value() == kTotalOperationalTime); - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.pausedTime.HasValue() == true); - NL_TEST_ASSERT(inSuite, genericOperationCompletion3.pausedTime.Value().Value() == kPausedTime); -} - const nlTest sTests[] = { NL_TEST_DEF("Test struct GenericOperationalState: constructor with only StateID", TestStructGenericOperationalStateConstructorWithOnlyStateID), @@ -598,7 +562,6 @@ const nlTest sTests[] = { NL_TEST_DEF("Test struct GenericOperationalPhase: constructor", TestStructGenericOperationalPhaseConstructor), NL_TEST_DEF("Test struct GenericOperationalPhase: copy constructor", TestStructGenericOperationalPhaseCopyConstructor), NL_TEST_DEF("Test struct GenericOperationalPhase: copy assignment", TestStructGenericOperationalPhaseCopyAssignment), - NL_TEST_DEF("Test struct GenericOperationalCompletion: constructor", TestStructGenericOperationalCompletionConstructor), NL_TEST_SENTINEL() }; diff --git a/src/app/tests/suites/TestActivatedCarbonFilterMonitoring.yaml b/src/app/tests/suites/TestActivatedCarbonFilterMonitoring.yaml new file mode 100644 index 00000000000000..c47e01fc473bf4 --- /dev/null +++ b/src/app/tests/suites/TestActivatedCarbonFilterMonitoring.yaml @@ -0,0 +1,57 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Activated Carbon Filter Monitoring Cluster Tests + +config: + nodeId: 0x12344321 + cluster: "Activated Carbon Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read Replacement Product List" + command: "readAttribute" + attribute: "ReplacementProductList" + response: + value: + [ + { + ProductIdentifierType: 0, + ProductIdentifierValue: "111112222233", + }, + { + ProductIdentifierType: 1, + ProductIdentifierValue: "gtin8xxx", + }, + { + ProductIdentifierType: 2, + ProductIdentifierValue: "4444455555666", + }, + { + ProductIdentifierType: 3, + ProductIdentifierValue: "gtin14xxxxxxxx", + }, + { + ProductIdentifierType: 4, + ProductIdentifierValue: "oem20xxxxxxxxxxxxxxx", + }, + ] diff --git a/src/app/tests/suites/TestHepaFilterMonitoring.yaml b/src/app/tests/suites/TestHepaFilterMonitoring.yaml new file mode 100644 index 00000000000000..44b79eec8afc5c --- /dev/null +++ b/src/app/tests/suites/TestHepaFilterMonitoring.yaml @@ -0,0 +1,57 @@ +# Copyright (c) 2021 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: HEPA Filter Monitoring Cluster Tests + +config: + nodeId: 0x12344321 + cluster: "HEPA Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read Replacement Product List" + command: "readAttribute" + attribute: "ReplacementProductList" + response: + value: + [ + { + ProductIdentifierType: 0, + ProductIdentifierValue: "111112222233", + }, + { + ProductIdentifierType: 1, + ProductIdentifierValue: "gtin8xxx", + }, + { + ProductIdentifierType: 2, + ProductIdentifierValue: "4444455555666", + }, + { + ProductIdentifierType: 3, + ProductIdentifierValue: "gtin14xxxxxxxx", + }, + { + ProductIdentifierType: 4, + ProductIdentifierValue: "oem20xxxxxxxxxxxxxxx", + }, + ] diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 5bb3dc1ca16829..dce34aca81dbcd 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -9380,107 +9380,107 @@ PICS: id: OPSTATE.S.C04.Tx # Smoke CO Alarm Cluster Test Plan - - label: "Does the device implement the SMCO cluster as a server?" - id: SMCO.S + - label: "Does the device implement the SMOKECO cluster as a server?" + id: SMOKECO.S - - label: "Does the device implement the SMCO cluster as a client?" - id: SMCO.C + - label: "Does the device implement the SMOKECO cluster as a client?" + id: SMOKECO.C # # server / features # - label: "Does the device support this specific cluster feature?" - id: SMCO.S.F00 + id: SMOKECO.S.F00 - label: "Does the device support this specific cluster feature?" - id: SMCO.S.F01 + id: SMOKECO.S.F01 # # server / attributes # - label: "Does the device implement the ExpressedState attribute?" - id: SMCO.S.A0000 + id: SMOKECO.S.A0000 - label: "Does the device implement the SmokeState attribute?" - id: SMCO.S.A0001 + id: SMOKECO.S.A0001 - label: "Does the device implement the COState attribute?" - id: SMCO.S.A0002 + id: SMOKECO.S.A0002 - label: "Does the device implement the BatteryAlert attribute?" - id: SMCO.S.A0003 + id: SMOKECO.S.A0003 - label: "Does the device implement the DeviceMuted attribute?" - id: SMCO.S.A0004 + id: SMOKECO.S.A0004 - label: "Does the device implement the TestInProgress attribute?" - id: SMCO.S.A0005 + id: SMOKECO.S.A0005 - label: "Does the device implement the HardwareFaultAlert attribute?" - id: SMCO.S.A0006 + id: SMOKECO.S.A0006 - label: "Does the device implement the EndOfServiceAlert attribute?" - id: SMCO.S.A0007 + id: SMOKECO.S.A0007 - label: "Does the device implement the InterconnectSmokeAlarm attribute?" - id: SMCO.S.A0008 + id: SMOKECO.S.A0008 - label: "Does the device implement the InterconnectCOAlarm attribute?" - id: SMCO.S.A0009 + id: SMOKECO.S.A0009 - label: "Does the device implement the ContaminationState attribute?" - id: SMCO.S.A0010 + id: SMOKECO.S.A0010 - label: "Does the device implement the SensitivityLevel attribute?" - id: SMCO.S.A0011 + id: SMOKECO.S.A0011 - label: "Does the device implement the ExpiryDate attribute?" - id: SMCO.S.A0012 + id: SMOKECO.S.A0012 - label: "Does the device implement the ContaminationState attribute?" - id: SMCO.S.A000a + id: SMOKECO.S.A000a - label: "Does the device implement the SensitivityLevel attribute?" - id: SMCO.S.A000b + id: SMOKECO.S.A000b - label: "Does the device implement the ExpiryDate attribute?" - id: SMCO.S.A000c + id: SMOKECO.S.A000c # # server / Events # - label: "Does the device implement the SmokeAlarm event?" - id: SMCO.S.E00 + id: SMOKECO.S.E00 - label: "Does the device implement the COAlarm event?" - id: SMCO.S.E01 + id: SMOKECO.S.E01 - label: "Does the device implement the LowBattery event?" - id: SMCO.S.E02 + id: SMOKECO.S.E02 - label: "Does the device implement the HardwareFault event?" - id: SMCO.S.E03 + id: SMOKECO.S.E03 - label: "Does the device implement the EndOfService event?" - id: SMCO.S.E04 + id: SMOKECO.S.E04 - label: "Does the device implement the SelfTestComplete event?" - id: SMCO.S.E05 + id: SMOKECO.S.E05 - label: "Does the device implement the AlarmMuted event?" - id: SMCO.S.E06 + id: SMOKECO.S.E06 - label: "Does the device implement the MuteEnded event?" - id: SMCO.S.E07 + id: SMOKECO.S.E07 - label: "Does the device implement the InterconnectSmokeAlarm event?" - id: SMCO.S.E08 + id: SMOKECO.S.E08 - label: "Does the device implement the InterconnectCOAlarm event?" - id: SMCO.S.E09 + id: SMOKECO.S.E09 - label: "Does the device implement the AllClear event?" - id: SMCO.S.E10 + id: SMOKECO.S.E10 # # server / manually @@ -9488,18 +9488,18 @@ PICS: - label: "Can the TestInProgress attribute be changed by physical control at the device?" - id: SMCO.M.ManuallyControlledTest + id: SMOKECO.M.ManuallyControlledTest - label: "Can the DeviceMuted attribute be changed by physical control at the device?" - id: SMCO.M.ManuallyControlledMute + id: SMOKECO.M.ManuallyControlledMute # # server / commandsReceived # - label: "Does the device implement receiving the SelfTestRequest command?" - id: SMCO.S.C00.Rsp + id: SMOKECO.S.C00.Rsp # Laundry Washer Mode Cluster diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_1_1.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_1_1.yaml similarity index 99% rename from src/app/tests/suites/certification/Test_TC_SMCO_1_1.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_1_1.yaml index 48c38a4c0957c1..c9762f148a7dc1 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_1_1.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 4.1.1. [TC-SMCO-1.1] Global Attributes with DUT as Server +name: 4.1.1. [TC-SMOKECO-1.1] Global Attributes with DUT as Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_1.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_1.yaml similarity index 98% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_1.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_1.yaml index 5eeb7084800ab7..5959a3d6da1dc5 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_1.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 4.2.1. [TC-SMCO-2.1] Attributes with DUT as Server +name: 4.2.1. [TC-SMOKECO-2.1] Attributes with DUT as Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_2.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_2.yaml similarity index 98% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_2.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_2.yaml index a36cb1a46944cf..0e44017c4df7ec 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_2.yaml @@ -13,7 +13,8 @@ # limitations under the License. name: - 4.2.2. [TC-SMCO-2.2] Primary Functionality - Smoke Alarm with DUT as Server + 4.2.2. [TC-SMOKECO-2.2] Primary Functionality - Smoke Alarm with DUT as + Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_3.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_3.yaml similarity index 98% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_3.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_3.yaml index 96d3f41e2047d8..eed913616c10cd 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_3.yaml @@ -12,7 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 4.2.3. [TC-SMCO-2.3] Primary Functionality - CO Alarm with DUT as Server +name: + 4.2.3. [TC-SMOKECO-2.3] Primary Functionality - CO Alarm with DUT as Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_4.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_4.yaml similarity index 99% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_4.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_4.yaml index 353826179b1d74..5326a83d5fe16b 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_4.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_4.yaml @@ -13,7 +13,8 @@ # limitations under the License. name: - 4.2.4. [TC-SMCO-2.4] Secondary Functionality - Mandatory with DUT as Server + 4.2.4. [TC-SMOKECO-2.4] Secondary Functionality - Mandatory with DUT as + Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_5.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_5.yaml similarity index 99% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_5.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_5.yaml index edb7e6d8cf3021..3607665b0c8f46 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_5.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_5.yaml @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: 4.2.5. [TC-SMCO-2.5] Secondary Functionality - Optional with DUT as Server +name: + 4.2.5. [TC-SMOKECO-2.5] Secondary Functionality - Optional with DUT as + Server PICS: - SMOKECO.S diff --git a/src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_6.yaml similarity index 95% rename from src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml rename to src/app/tests/suites/certification/Test_TC_SMOKECO_2_6.yaml index 5d68637c3b5a46..6aba1c9adf70da 100644 --- a/src/app/tests/suites/certification/Test_TC_SMCO_2_6.yaml +++ b/src/app/tests/suites/certification/Test_TC_SMOKECO_2_6.yaml @@ -13,8 +13,8 @@ # limitations under the License. name: - 4.2.6. [TC-SMCO-2.6] ExpressedState Attribute - Multiple Alarms with DUT as - Server + 4.2.6. [TC-SMOKECO-2.6] ExpressedState Attribute - Multiple Alarms with DUT + as Server PICS: - SMOKECO.S @@ -60,6 +60,18 @@ config: HIEST_PRI_ALARM: type: int8u defaultValue: 1 + HIEST_PRI_ALARM_2: + type: int8u + defaultValue: 2 + HIEST_PRI_ALARM_3: + type: int8u + defaultValue: 7 + HIEST_PRI_ALARM_4: + type: int8u + defaultValue: 7 + HIEST_PRI_ALARM_5: + type: int8u + defaultValue: 3 tests: - label: "Commission DUT to TH" @@ -183,7 +195,7 @@ tests: PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event" - PICS: DGGEN.S.C00.Rsp + PICS: SMOKECO.S.A0008 && DGGEN.S.C00.Rsp cluster: "General Diagnostics" endpoint: 0 command: "TestEventTrigger" @@ -212,7 +224,7 @@ tests: Endpoint 0 with EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event" - PICS: DGGEN.S.C00.Rsp + PICS: SMOKECO.S.A0009 && DGGEN.S.C00.Rsp cluster: "General Diagnostics" endpoint: 0 command: "TestEventTrigger" @@ -334,7 +346,7 @@ tests: command: "readAttribute" attribute: "ExpressedState" response: - value: HIEST_PRI_ALARM + value: HIEST_PRI_ALARM_2 constraints: type: enum8 @@ -371,7 +383,7 @@ tests: command: "readAttribute" attribute: "ExpressedState" response: - value: HIEST_PRI_ALARM + value: HIEST_PRI_ALARM_3 constraints: type: enum8 @@ -381,7 +393,7 @@ tests: PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event Clear" - PICS: DGGEN.S.C00.Rsp + PICS: SMOKECO.S.A0009 && DGGEN.S.C00.Rsp cluster: "General Diagnostics" endpoint: 0 command: "TestEventTrigger" @@ -409,7 +421,7 @@ tests: command: "readAttribute" attribute: "ExpressedState" response: - value: HIEST_PRI_ALARM + value: HIEST_PRI_ALARM_4 constraints: type: enum8 @@ -419,7 +431,7 @@ tests: PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event Clear" - PICS: DGGEN.S.C00.Rsp + PICS: SMOKECO.S.A0008 && DGGEN.S.C00.Rsp cluster: "General Diagnostics" endpoint: 0 command: "TestEventTrigger" @@ -447,7 +459,7 @@ tests: command: "readAttribute" attribute: "ExpressedState" response: - value: HIEST_PRI_ALARM + value: HIEST_PRI_ALARM_5 constraints: type: enum8 diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 549602247b4be4..426f1a65956d06 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2752,40 +2752,40 @@ RVCCLEANMS.S.C01.Rsp=1 RVCCLEANMS.S.C03.Tx=1 # Smoke CO Alarm Cluster -SMCO.S=1 -SMCO.S.F00=1 -SMCO.S.F01=1 -SMCO.S.A0000=1 -SMCO.S.A0001=1 -SMCO.S.A0002=1 -SMCO.S.A0003=1 -SMCO.S.A0004=1 -SMCO.S.A0005=1 -SMCO.S.A0006=1 -SMCO.S.A0007=1 -SMCO.S.A0008=1 -SMCO.S.A0009=1 -SMCO.S.A0010=1 -SMCO.S.A0011=1 -SMCO.S.A0012=1 -SMCO.S.A000a=1 -SMCO.S.A000b=1 -SMCO.S.A000c=1 -SMCO.S.E00=1 -SMCO.S.E01=1 -SMCO.S.E02=1 -SMCO.S.E03=1 -SMCO.S.E04=1 -SMCO.S.E05=1 -SMCO.S.E06=1 -SMCO.S.E07=1 -SMCO.S.E08=1 -SMCO.S.E09=1 -SMCO.S.E10=1 -SMCO.M.ManuallyControlledTest=1 -SMCO.M.ManuallyControlledMute=1 -SMCO.S.C00.Rsp=1 -SMCO.C=1 +SMOKECO.S=1 +SMOKECO.S.F00=1 +SMOKECO.S.F01=1 +SMOKECO.S.A0000=1 +SMOKECO.S.A0001=1 +SMOKECO.S.A0002=1 +SMOKECO.S.A0003=1 +SMOKECO.S.A0004=1 +SMOKECO.S.A0005=1 +SMOKECO.S.A0006=1 +SMOKECO.S.A0007=1 +SMOKECO.S.A0008=1 +SMOKECO.S.A0009=1 +SMOKECO.S.A0010=1 +SMOKECO.S.A0011=1 +SMOKECO.S.A0012=1 +SMOKECO.S.A000a=1 +SMOKECO.S.A000b=1 +SMOKECO.S.A000c=1 +SMOKECO.S.E00=1 +SMOKECO.S.E01=1 +SMOKECO.S.E02=1 +SMOKECO.S.E03=1 +SMOKECO.S.E04=1 +SMOKECO.S.E05=1 +SMOKECO.S.E06=1 +SMOKECO.S.E07=1 +SMOKECO.S.E08=1 +SMOKECO.S.E09=1 +SMOKECO.S.E10=1 +SMOKECO.M.ManuallyControlledTest=1 +SMOKECO.M.ManuallyControlledMute=1 +SMOKECO.S.C00.Rsp=1 +SMOKECO.C=1 #Temperature Controlled Cabinet Mode Cluster TCCM.S=1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 377dd568b2aea0..7db3d988af0d3b 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -178,13 +178,13 @@ "RelativeHumidityMeasurement": ["Test_TC_RH_1_1", "Test_TC_RH_2_1"], "SecureChannel": [], "SmokeCOAlarm": [ - "Test_TC_SMCO_1_1", - "Test_TC_SMCO_2_1", - "Test_TC_SMCO_2_2", - "Test_TC_SMCO_2_3", - "Test_TC_SMCO_2_4", - "Test_TC_SMCO_2_5", - "Test_TC_SMCO_2_6" + "Test_TC_SMOKECO_1_1", + "Test_TC_SMOKECO_2_1", + "Test_TC_SMOKECO_2_2", + "Test_TC_SMOKECO_2_3", + "Test_TC_SMOKECO_2_4", + "Test_TC_SMOKECO_2_5", + "Test_TC_SMOKECO_2_6" ], "Switch": ["Test_TC_SWTCH_1_1", "Test_TC_SWTCH_2_1"], "TemperatureMeasurement": ["Test_TC_TMP_1_1", "Test_TC_TMP_2_1"], @@ -303,6 +303,8 @@ ], "Scenes": ["Test_TC_S_1_1"], "ResourceMonitoring": [ + "TestActivatedCarbonFilterMonitoring", + "TestHepaFilterMonitoring", "Test_TC_ACFREMON_1_1", "Test_TC_ACFREMON_2_1", "Test_TC_HEPAFREMON_1_1", diff --git a/src/controller/tests/TestEventCaching.cpp b/src/controller/tests/TestEventCaching.cpp index 06100250bdc2f4..24a101aeeb95b8 100644 --- a/src/controller/tests/TestEventCaching.cpp +++ b/src/controller/tests/TestEventCaching.cpp @@ -128,9 +128,16 @@ class TestReadCallback : public app::ClusterStateCache::Callback { public: TestReadCallback() : mClusterCacheAdapter(*this) {} - void OnDone(app::ReadClient *) {} + void OnDone(app::ReadClient *) override {} + + void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override + { + ++mEventsSeen; + } app::ClusterStateCache mClusterCacheAdapter; + + size_t mEventsSeen = 0; }; namespace { @@ -181,6 +188,7 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) chip::EventNumber lastEventNumber; GenerateEvents(apSuite, firstEventNumber, lastEventNumber); + NL_TEST_ASSERT(apSuite, lastEventNumber > firstEventNumber); app::EventPathParams eventPath; eventPath.mEndpointId = kTestEndpointId; @@ -203,10 +211,12 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) uint8_t generationCount = 0; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -216,21 +226,23 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); Optional highestEventNumber; readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); - NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == 4); + NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == lastEventNumber); // // Re-run the iterator but pass in a path filter: EP*/TestCluster/EID* // generationCount = 0; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -241,17 +253,19 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) }, app::EventPathParams(kInvalidEndpointId, Clusters::UnitTesting::Id, kInvalidEventId)); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); // // Re-run the iterator but pass in a path filter: EP*/TestCluster/TestEvent // generationCount = 0; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -262,17 +276,20 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) }, app::EventPathParams(kInvalidEndpointId, Clusters::UnitTesting::Id, Clusters::UnitTesting::Events::TestEvent::Id)); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); // - // Re-run the iterator but pass in a min event number filter (EventNumber = 1). We should only receive 4 events. + // Re-run the iterator but pass in a min event number filter + // (EventNumber = firstEventNumber + 1). We should only receive 4 events. // generationCount = 1; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber + 1); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -281,20 +298,23 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) generationCount++; return CHIP_NO_ERROR; }, - app::EventPathParams(), 1); + app::EventPathParams(), firstEventNumber + 1); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); // - // Re-run the iterator but pass in a min event number filter (EventNumber = 1) AND a path filter. We should only receive 4 + // Re-run the iterator but pass in a min event number filter + // (EventNumber = firstEventNumber + 1) AND a path filter. We should only receive 4 // events. // generationCount = 1; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, firstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= firstEventNumber + 1); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -303,14 +323,15 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) generationCount++; return CHIP_NO_ERROR; }, - app::EventPathParams(kInvalidEndpointId, Clusters::UnitTesting::Id, kInvalidEventId), 1); + app::EventPathParams(kInvalidEndpointId, Clusters::UnitTesting::Id, kInvalidEventId), firstEventNumber + 1); - NL_TEST_ASSERT(apSuite, generationCount == 5); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - firstEventNumber + 1); } // // Generate more events. // + const EventNumber oldFirstEventNumber = firstEventNumber; GenerateEvents(apSuite, firstEventNumber, lastEventNumber); { @@ -327,10 +348,12 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) // uint8_t generationCount = 0; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, oldFirstEventNumber, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber >= oldFirstEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -341,7 +364,7 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(apSuite, generationCount == 10); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - oldFirstEventNumber + 1); Optional highestEventNumber; readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); @@ -368,18 +391,28 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) app::ReadClient::InteractionType::Read); readCallback.mClusterCacheAdapter.ClearEventCache(); - readCallback.mClusterCacheAdapter.SetHighestReceivedEventNumber(3); + constexpr EventNumber kLastSeenEventNumber = 3; + NL_TEST_ASSERT(apSuite, kLastSeenEventNumber < lastEventNumber); + readCallback.mClusterCacheAdapter.SetHighestReceivedEventNumber(kLastSeenEventNumber); + readParams.mEventNumber.ClearValue(); + + readCallback.mEventsSeen = 0; NL_TEST_ASSERT(apSuite, readClient.SendRequest(readParams) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); - uint8_t generationCount = 4; + // We should only get events with event numbers larger than kHighestEventNumberSeen. + NL_TEST_ASSERT(apSuite, readCallback.mEventsSeen == lastEventNumber - kLastSeenEventNumber); + + uint8_t generationCount = kLastSeenEventNumber + 1; readCallback.mClusterCacheAdapter.ForEachEventData( - [&apSuite, &readCallback, &generationCount](const app::EventHeader & header) { + [&apSuite, &readCallback, &generationCount, lastEventNumber](const app::EventHeader & header) { NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, header.mEventNumber > kLastSeenEventNumber); + NL_TEST_ASSERT(apSuite, header.mEventNumber <= lastEventNumber); Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) == CHIP_NO_ERROR); @@ -390,10 +423,10 @@ void TestReadEvents::TestBasicCaching(nlTestSuite * apSuite, void * apContext) return CHIP_NO_ERROR; }); - NL_TEST_ASSERT(apSuite, generationCount == 10); + NL_TEST_ASSERT(apSuite, generationCount == lastEventNumber - oldFirstEventNumber + 1); Optional highestEventNumber; readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); - NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == 9); + NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == lastEventNumber); } // diff --git a/src/controller/tests/TestEventNumberCaching.cpp b/src/controller/tests/TestEventNumberCaching.cpp index 8c291013e874c5..982e98fcc2cc05 100644 --- a/src/controller/tests/TestEventNumberCaching.cpp +++ b/src/controller/tests/TestEventNumberCaching.cpp @@ -128,9 +128,16 @@ class TestReadCallback : public app::ClusterStateCache::Callback { public: TestReadCallback() : mClusterCacheAdapter(*this, Optional::Missing(), false /*cacheData*/) {} - void OnDone(app::ReadClient *) {} + void OnDone(app::ReadClient *) override {} + + void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override + { + ++mEventsSeen; + } app::ClusterStateCache mClusterCacheAdapter; + + size_t mEventsSeen = 0; }; namespace { @@ -178,6 +185,7 @@ void TestReadEvents::TestEventNumberCaching(nlTestSuite * apSuite, void * apCont chip::EventNumber lastEventNumber; GenerateEvents(apSuite, firstEventNumber, lastEventNumber); + NL_TEST_ASSERT(apSuite, lastEventNumber > firstEventNumber); app::EventPathParams eventPath; eventPath.mEndpointId = kTestEndpointId; @@ -201,23 +209,22 @@ void TestReadEvents::TestEventNumberCaching(nlTestSuite * apSuite, void * apCont ctx.DrainAndServiceIO(); - readCallback.mClusterCacheAdapter.ForEachEventData([&apSuite, &readCallback](const app::EventHeader & header) { - NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); - NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); - NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + NL_TEST_ASSERT(apSuite, readCallback.mEventsSeen == lastEventNumber - firstEventNumber + 1); + + readCallback.mClusterCacheAdapter.ForEachEventData([&apSuite](const app::EventHeader & header) { + // We are not caching data. + NL_TEST_ASSERT(apSuite, false); - Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; - NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) != CHIP_NO_ERROR); return CHIP_NO_ERROR; }); readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); - NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == 4); + NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == lastEventNumber); } // // Clear out the event cache and set its highest received event number to a non zero value. Validate that - // we don't receive events lower than that value. + // we don't receive events except ones larger than that value. // { app::ReadClient readClient(engine, &ctx.GetExchangeManager(), readCallback.mClusterCacheAdapter.GetBufferedCallback(), @@ -227,24 +234,32 @@ void TestReadEvents::TestEventNumberCaching(nlTestSuite * apSuite, void * apCont Optional highestEventNumber; readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); NL_TEST_ASSERT(apSuite, !highestEventNumber.HasValue()); - readCallback.mClusterCacheAdapter.SetHighestReceivedEventNumber(3); + const EventNumber kHighestEventNumberSeen = lastEventNumber - 1; + NL_TEST_ASSERT(apSuite, kHighestEventNumberSeen < lastEventNumber); + + readCallback.mClusterCacheAdapter.SetHighestReceivedEventNumber(kHighestEventNumberSeen); + + readCallback.mEventsSeen = 0; + + readParams.mEventNumber.ClearValue(); + NL_TEST_ASSERT(apSuite, !readParams.mEventNumber.HasValue()); NL_TEST_ASSERT(apSuite, readClient.SendRequest(readParams) == CHIP_NO_ERROR); ctx.DrainAndServiceIO(); - readCallback.mClusterCacheAdapter.ForEachEventData([&apSuite, &readCallback](const app::EventHeader & header) { - NL_TEST_ASSERT(apSuite, header.mPath.mClusterId == Clusters::UnitTesting::Id); - NL_TEST_ASSERT(apSuite, header.mPath.mEventId == Clusters::UnitTesting::Events::TestEvent::Id); - NL_TEST_ASSERT(apSuite, header.mPath.mEndpointId == kTestEndpointId); + // We should only get events with event numbers larger than kHighestEventNumberSeen. + NL_TEST_ASSERT(apSuite, readCallback.mEventsSeen == lastEventNumber - kHighestEventNumberSeen); + + readCallback.mClusterCacheAdapter.ForEachEventData([&apSuite](const app::EventHeader & header) { + // We are not caching data. + NL_TEST_ASSERT(apSuite, false); - Clusters::UnitTesting::Events::TestEvent::DecodableType eventData; - NL_TEST_ASSERT(apSuite, readCallback.mClusterCacheAdapter.Get(header.mEventNumber, eventData) != CHIP_NO_ERROR); return CHIP_NO_ERROR; }); readCallback.mClusterCacheAdapter.GetHighestReceivedEventNumber(highestEventNumber); - NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == 4); + NL_TEST_ASSERT(apSuite, highestEventNumber.HasValue() && highestEventNumber.Value() == lastEventNumber); } NL_TEST_ASSERT(apSuite, ctx.GetExchangeManager().GetNumActiveExchanges() == 0); diff --git a/src/credentials/BUILD.gn b/src/credentials/BUILD.gn index da66062ad93dc2..badfeaf6e4e4e7 100644 --- a/src/credentials/BUILD.gn +++ b/src/credentials/BUILD.gn @@ -92,6 +92,7 @@ static_library("credentials") { "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/platform", + "${chip_root}/src/protocols:type_definitions", "${nlassert_root}:nlassert", ] } diff --git a/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj b/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj index a7993016697d66..67692af8f88bc4 100644 --- a/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj +++ b/src/darwin/CHIPTool/CHIPTool.xcodeproj/project.pbxproj @@ -447,7 +447,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -508,7 +508,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index a4e0577f8f92ef..0d9b693296bc2d 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -1484,6 +1484,7 @@ - (void)test017_TestMTRDeviceBasics [self waitForExpectations:@[ subscriptionExpectation ] timeout:60]; XCTAssertNotEqual(attributeReportsReceived, 0); + XCTAssertNotEqual(eventReportsReceived, 0); attributeReportsReceived = 0; eventReportsReceived = 0; diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index ba81628e65a01a..8dc126d5e24f2a 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -1686,7 +1686,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -1858,7 +1858,7 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; diff --git a/src/inet/UDPEndPointImplSockets.cpp b/src/inet/UDPEndPointImplSockets.cpp index 5c9748d0cf32fb..b681a56fabe92f 100644 --- a/src/inet/UDPEndPointImplSockets.cpp +++ b/src/inet/UDPEndPointImplSockets.cpp @@ -469,7 +469,14 @@ CHIP_ERROR UDPEndPointImplSockets::GetSocket(IPAddressType addressType) { return CHIP_ERROR_POSIX(errno); } - ReturnErrorOnFailure(static_cast(&GetSystemLayer())->StartWatchingSocket(mSocket, &mWatch)); + CHIP_ERROR err = static_cast(&GetSystemLayer())->StartWatchingSocket(mSocket, &mWatch); + if (err != CHIP_NO_ERROR) + { + // Our mWatch is not valid; make sure we never use it. + close(mSocket); + mSocket = kInvalidSocketFd; + return err; + } mAddrType = addressType; diff --git a/src/lib/format/BUILD.gn b/src/lib/format/BUILD.gn index c75ecd084e1457..b593d88cf59d7a 100644 --- a/src/lib/format/BUILD.gn +++ b/src/lib/format/BUILD.gn @@ -64,6 +64,7 @@ source_set("protocol-decoder") { ":tlv-metadata-headers", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", + "${chip_root}/src/protocols:type_definitions", ] public_configs = [ "${chip_root}/src:includes" ] diff --git a/src/messaging/BUILD.gn b/src/messaging/BUILD.gn index d5e51fc0f61056..3c64ef64ebd3f1 100644 --- a/src/messaging/BUILD.gn +++ b/src/messaging/BUILD.gn @@ -72,6 +72,7 @@ static_library("messaging") { "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/platform", + "${chip_root}/src/protocols/secure_channel:type_definitions", "${chip_root}/src/transport", "${chip_root}/src/transport/raw", ] diff --git a/src/platform/Linux/OTAImageProcessorImpl.cpp b/src/platform/Linux/OTAImageProcessorImpl.cpp index 4b6695f1fe7d13..4647a0df69fba0 100644 --- a/src/platform/Linux/OTAImageProcessorImpl.cpp +++ b/src/platform/Linux/OTAImageProcessorImpl.cpp @@ -127,6 +127,8 @@ void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) unlink(imageProcessor->mImageFile); + imageProcessor->mParams.downloadedBytes = 0; + imageProcessor->mParams.totalFileBytes = 0; imageProcessor->mHeaderParser.Init(); imageProcessor->mOfs.open(imageProcessor->mImageFile, std::ofstream::out | std::ofstream::ate | std::ofstream::app); if (!imageProcessor->mOfs.good()) diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp index 5719b816b95676..4f04daf464730f 100644 --- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -60,8 +60,6 @@ extern "C" { #include #endif -extern uint16_t rsi_ble_measurement_hndl; -extern rsi_ble_event_conn_status_t conn_event_to_app; extern sl_wfx_msg_t event_msg; StaticTask_t rsiBLETaskStruct; @@ -589,8 +587,21 @@ CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) { ChipLogError(DeviceLayer, "rsi_ble_set_advertise_data() success: %ld", result); } - - // err = MapBLEError(result); + index = 0; + responseData[index++] = 0x02; // length + responseData[index++] = CHIP_ADV_DATA_TYPE_FLAGS; // AD type : flags + responseData[index++] = CHIP_ADV_DATA_FLAGS; + responseData[index++] = CHIP_ADV_SHORT_UUID_LEN + 1; // AD length + responseData[index++] = CHIP_ADV_DATA_TYPE_UUID; // AD type : uuid + responseData[index++] = ShortUUID_CHIPoBLEService[0]; // AD value + responseData[index++] = ShortUUID_CHIPoBLEService[1]; + + responseData[index++] = static_cast(mDeviceNameLength + 1); // length + responseData[index++] = CHIP_ADV_DATA_TYPE_NAME; // AD type : name + memcpy(&responseData[index], mDeviceName, mDeviceNameLength); // AD value + index += mDeviceNameLength; + + rsi_ble_set_scan_response_data(responseData, index); ChipLogProgress(DeviceLayer, "ConfigureAdvertisingData End"); exit: @@ -659,8 +670,16 @@ int32_t BLEManagerImpl::SendBLEAdvertisementCommand(void) ble_adv.filter_type = RSI_BLE_ADV_FILTER_TYPE; ble_adv.direct_addr_type = RSI_BLE_ADV_DIR_ADDR_TYPE; rsi_ascii_dev_address_to_6bytes_rev(ble_adv.direct_addr, (int8_t *) RSI_BLE_ADV_DIR_ADDR); - ble_adv.adv_int_min = RSI_BLE_ADV_INT_MIN; - ble_adv.adv_int_max = RSI_BLE_ADV_INT_MAX; + if (mFlags.Has(Flags::kFastAdvertisingEnabled)) + { + ble_adv.adv_int_min = CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MIN; + ble_adv.adv_int_max = CHIP_DEVICE_CONFIG_BLE_FAST_ADVERTISING_INTERVAL_MAX; + } + else + { + ble_adv.adv_int_min = CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MIN; + ble_adv.adv_int_max = CHIP_DEVICE_CONFIG_BLE_SLOW_ADVERTISING_INTERVAL_MAX; + } ble_adv.own_addr_type = LE_RANDOM_ADDRESS; ble_adv.adv_channel_map = RSI_BLE_ADV_CHANNEL_MAP; return rsi_ble_start_advertising_with_values(&ble_adv); @@ -781,6 +800,10 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt) CHIP_ERROR err = CHIP_NO_ERROR; bool isIndicationEnabled = false; ChipDeviceEvent event; + CHIPoBLEConState * bleConnState; + + bleConnState = GetConnectionState(event_msg.connectionHandle); + VerifyOrExit(bleConnState != NULL, err = CHIP_ERROR_NO_MEMORY); // Determine if the client is enabling or disabling notification/indication. if (evt->att_value[0] != 0) @@ -792,9 +815,12 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt) if (isIndicationEnabled) { - // Post an event to the CHIP queue to process either a CHIPoBLE Subscribe or Unsubscribe based on - // whether the client is enabling or disabling indications. + // If indications are not already enabled for the connection... + if (!bleConnState->subscribed) { + bleConnState->subscribed = 1; + // Post an event to the CHIP queue to process either a CHIPoBLE Subscribe or Unsubscribe based on + // whether the client is enabling or disabling indications. event.Type = DeviceEventType::kCHIPoBLESubscribe; event.CHIPoBLESubscribe.ConId = 1; // TODO:: To be replaced by device mac address err = PlatformMgr().PostEvent(&event); @@ -802,10 +828,16 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt) } else { + bleConnState->subscribed = 0; event.Type = DeviceEventType::kCHIPoBLEUnsubscribe; event.CHIPoBLESubscribe.ConId = 1; // TODO:: To be replaced by device mac address err = PlatformMgr().PostEvent(&event); } +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(DeviceLayer, "HandleTXCharCCCDWrite() failed: %s", ErrorStr(err)); + } } void BLEManagerImpl::HandleRXCharWrite(rsi_ble_event_write_t * evt) diff --git a/src/platform/silabs/rs911x/rsi_ble_config.h b/src/platform/silabs/rs911x/rsi_ble_config.h index 550e29fda03ed2..c308a391209a74 100644 --- a/src/platform/silabs/rs911x/rsi_ble_config.h +++ b/src/platform/silabs/rs911x/rsi_ble_config.h @@ -24,6 +24,12 @@ * * Macros * ******************************************************/ //! application event list +// TODO: remove this define after integration of the new wifi sdk +#ifndef RSI_FAILURE +// failure return value +#define RSI_FAILURE -1 +#endif + #define RSI_BLE_CONN_EVENT (0x01) #define RSI_BLE_DISCONN_EVENT (0x02) #define RSI_BLE_GATT_WRITE_EVENT (0x03) diff --git a/src/protocols/BUILD.gn b/src/protocols/BUILD.gn index ed5b9dd94e3cd9..10b48fb7e46cc3 100644 --- a/src/protocols/BUILD.gn +++ b/src/protocols/BUILD.gn @@ -14,6 +14,10 @@ import("//build_overrides/chip.gni") +source_set("type_definitions") { + sources = [ "Protocols.h" ] +} + static_library("protocols") { output_name = "libChipProtocols" @@ -35,6 +39,7 @@ static_library("protocols") { public_deps = [ ":im_status", + ":type_definitions", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/messaging", @@ -52,6 +57,7 @@ static_library("im_status") { cflags = [ "-Wconversion" ] public_deps = [ + ":type_definitions", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", ] diff --git a/src/protocols/secure_channel/BUILD.gn b/src/protocols/secure_channel/BUILD.gn index 8cf46f9d334a1f..93997d0642b37f 100644 --- a/src/protocols/secure_channel/BUILD.gn +++ b/src/protocols/secure_channel/BUILD.gn @@ -1,5 +1,24 @@ import("//build_overrides/chip.gni") +static_library("type_definitions") { + output_name = "libSecureChannelTypes" + + sources = [ + "Constants.h", + "StatusReport.cpp", + "StatusReport.h", + ] + + cflags = [ "-Wconversion" ] + + public_deps = [ + "${chip_root}/src/protocols:type_definitions", + "${chip_root}/src/system", + ] + + deps = [ "${chip_root}/src/lib/support" ] +} + static_library("secure_channel") { output_name = "libSecureChannel" @@ -10,7 +29,6 @@ static_library("secure_channel") { "CASEServer.h", "CASESession.cpp", "CASESession.h", - "Constants.h", "DefaultSessionResumptionStorage.cpp", "DefaultSessionResumptionStorage.h", "PASESession.cpp", @@ -24,8 +42,6 @@ static_library("secure_channel") { "SessionResumptionStorage.h", "SimpleSessionResumptionStorage.cpp", "SimpleSessionResumptionStorage.h", - "StatusReport.cpp", - "StatusReport.h", "UnsolicitedStatusHandler.cpp", "UnsolicitedStatusHandler.h", ] @@ -33,6 +49,7 @@ static_library("secure_channel") { cflags = [ "-Wconversion" ] public_deps = [ + ":type_definitions", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", "${chip_root}/src/messaging", @@ -41,16 +58,4 @@ static_library("secure_channel") { "${chip_root}/src/tracing:macros", "${chip_root}/src/transport", ] - - # secure channel requires messaging so it can send messages (e.g. for - # CASE/PASE handshakes). messaging requires secure channel so that it can do - # things like send standalone acks, which are a secure channel concept. - # - # secure channel requires transport so it can deal with sessions. transport - # requires secure channel so it can detect control messages, which are a - # secure channel concept. - allow_circular_includes_from = [ - "${chip_root}/src/messaging", - "${chip_root}/src/transport", - ] } diff --git a/src/setup_payload/BUILD.gn b/src/setup_payload/BUILD.gn index 42fb1c848a0e3b..30b97ceca74349 100644 --- a/src/setup_payload/BUILD.gn +++ b/src/setup_payload/BUILD.gn @@ -42,6 +42,7 @@ source_set("additional_data_payload") { "${chip_root}/src/crypto", "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", + "${chip_root}/src/protocols:type_definitions", "${chip_root}/src/setup_payload:additional_data_payload_buildconfig", ] } diff --git a/src/test_driver/efr32/args.gni b/src/test_driver/efr32/args.gni index 2ef6653a0181e2..a8d442d5c2140e 100644 --- a/src/test_driver/efr32/args.gni +++ b/src/test_driver/efr32/args.gni @@ -21,7 +21,6 @@ import("${chip_root}/src/platform/silabs/efr32/args.gni") silabs_sdk_target = get_label_info(":sdk", "label_no_toolchain") chip_enable_pw_rpc = true -cpp_standard = "gnu++17" chip_build_tests = true chip_enable_openthread = true chip_openthread_ftd = true diff --git a/src/test_driver/nrfconnect/prj.conf b/src/test_driver/nrfconnect/prj.conf index f70a0d95063dc9..134b2abe55c7d7 100644 --- a/src/test_driver/nrfconnect/prj.conf +++ b/src/test_driver/nrfconnect/prj.conf @@ -84,7 +84,7 @@ CONFIG_INIT_STACKS=y CONFIG_REBOOT=n # Build as C++14 -CONFIG_STD_CPP14=y +CONFIG_STD_CPP17=y # CHIP configuration CONFIG_CHIP=y diff --git a/src/transport/BUILD.gn b/src/transport/BUILD.gn index 66f19b95e223bd..f1f7ef534322a7 100644 --- a/src/transport/BUILD.gn +++ b/src/transport/BUILD.gn @@ -64,6 +64,7 @@ static_library("transport") { "${chip_root}/src/lib/dnssd", "${chip_root}/src/lib/support", "${chip_root}/src/platform", + "${chip_root}/src/protocols/secure_channel:type_definitions", "${chip_root}/src/setup_payload", "${chip_root}/src/tracing", "${chip_root}/src/tracing:macros", diff --git a/third_party/ti_simplelink_sdk/BUILD.gn b/third_party/ti_simplelink_sdk/BUILD.gn index 8f6c4806d2182a..363d94685955fe 100644 --- a/third_party/ti_simplelink_sdk/BUILD.gn +++ b/third_party/ti_simplelink_sdk/BUILD.gn @@ -110,7 +110,7 @@ config("ti_simplelink_freertos_config") { config("ti_simplelink_posix_config") { include_dirs = [ "${ti_simplelink_sdk_root}/source/ti/posix/gcc" ] cflags_c = [ "-std=c11" ] - cflags_cc = [ "-std=c++14" ] + cflags_cc = [ "-std=c++17" ] cflags = [ "-Wno-maybe-uninitialized", "-Wno-sign-compare", diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni index 08ef9bd1c6fd8a..06c925ff8b0774 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_sdk.gni @@ -277,7 +277,7 @@ template("ti_simplelink_sdk") { config("${sdk_target_name}_posix_config") { include_dirs = [ "${ti_simplelink_sdk_root}/source/ti/posix/gcc" ] cflags_c = [ "-std=c11" ] - cflags_cc = [ "-std=c++14" ] + cflags_cc = [ "-std=c++17" ] cflags = [ "-Wno-maybe-uninitialized", "-Wno-sign-compare", diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index c63754ed04852d..7caa48359ca68f 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -209,13 +209,13 @@ class TestList : public Command printf("Test_TC_PSCFG_2_1\n"); printf("Test_TC_RH_1_1\n"); printf("Test_TC_RH_2_1\n"); - printf("Test_TC_SMCO_1_1\n"); - printf("Test_TC_SMCO_2_1\n"); - printf("Test_TC_SMCO_2_2\n"); - printf("Test_TC_SMCO_2_3\n"); - printf("Test_TC_SMCO_2_4\n"); - printf("Test_TC_SMCO_2_5\n"); - printf("Test_TC_SMCO_2_6\n"); + printf("Test_TC_SMOKECO_1_1\n"); + printf("Test_TC_SMOKECO_2_1\n"); + printf("Test_TC_SMOKECO_2_2\n"); + printf("Test_TC_SMOKECO_2_3\n"); + printf("Test_TC_SMOKECO_2_4\n"); + printf("Test_TC_SMOKECO_2_5\n"); + printf("Test_TC_SMOKECO_2_6\n"); printf("Test_TC_SWTCH_1_1\n"); printf("Test_TC_SWTCH_2_1\n"); printf("Test_TC_TMP_1_1\n"); @@ -322,6 +322,8 @@ class TestList : public Command printf("TestGroupKeyManagementCluster\n"); printf("Test_TC_G_1_1\n"); printf("Test_TC_G_2_1\n"); + printf("TestActivatedCarbonFilterMonitoring\n"); + printf("TestHepaFilterMonitoring\n"); printf("Test_TC_ACFREMON_1_1\n"); printf("Test_TC_ACFREMON_2_1\n"); printf("Test_TC_HEPAFREMON_1_1\n"); @@ -60490,10 +60492,11 @@ class Test_TC_RH_2_1Suite : public TestCommand } }; -class Test_TC_SMCO_1_1Suite : public TestCommand +class Test_TC_SMOKECO_1_1Suite : public TestCommand { public: - Test_TC_SMCO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_1_1", 25, credsIssuerConfig) + Test_TC_SMOKECO_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_1_1", 25, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -60501,7 +60504,7 @@ class Test_TC_SMCO_1_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_SMCO_1_1Suite() {} + ~Test_TC_SMOKECO_1_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -60928,10 +60931,11 @@ class Test_TC_SMCO_1_1Suite : public TestCommand } }; -class Test_TC_SMCO_2_1Suite : public TestCommand +class Test_TC_SMOKECO_2_1Suite : public TestCommand { public: - Test_TC_SMCO_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_1", 14, credsIssuerConfig) + Test_TC_SMOKECO_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_1", 14, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -60939,7 +60943,7 @@ class Test_TC_SMCO_2_1Suite : public TestCommand AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } - ~Test_TC_SMCO_2_1Suite() {} + ~Test_TC_SMOKECO_2_1Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { @@ -61197,10 +61201,11 @@ class Test_TC_SMCO_2_1Suite : public TestCommand } }; -class Test_TC_SMCO_2_2Suite : public TestCommand +class Test_TC_SMOKECO_2_2Suite : public TestCommand { public: - Test_TC_SMCO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_2", 20, credsIssuerConfig) + Test_TC_SMOKECO_2_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_2", 20, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -61213,7 +61218,7 @@ class Test_TC_SMCO_2_2Suite : public TestCommand AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); } - ~Test_TC_SMCO_2_2Suite() {} + ~Test_TC_SMOKECO_2_2Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(990)); } @@ -61600,10 +61605,11 @@ class Test_TC_SMCO_2_2Suite : public TestCommand } }; -class Test_TC_SMCO_2_3Suite : public TestCommand +class Test_TC_SMOKECO_2_3Suite : public TestCommand { public: - Test_TC_SMCO_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_3", 20, credsIssuerConfig) + Test_TC_SMOKECO_2_3Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_3", 20, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -61616,7 +61622,7 @@ class Test_TC_SMCO_2_3Suite : public TestCommand AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); } - ~Test_TC_SMCO_2_3Suite() {} + ~Test_TC_SMOKECO_2_3Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(990)); } @@ -62002,10 +62008,11 @@ class Test_TC_SMCO_2_3Suite : public TestCommand } }; -class Test_TC_SMCO_2_4Suite : public TestCommand +class Test_TC_SMOKECO_2_4Suite : public TestCommand { public: - Test_TC_SMCO_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_4", 50, credsIssuerConfig) + Test_TC_SMOKECO_2_4Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_4", 50, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -62022,7 +62029,7 @@ class Test_TC_SMCO_2_4Suite : public TestCommand AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); } - ~Test_TC_SMCO_2_4Suite() {} + ~Test_TC_SMOKECO_2_4Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(2910)); } @@ -62961,10 +62968,11 @@ class Test_TC_SMCO_2_4Suite : public TestCommand } }; -class Test_TC_SMCO_2_5Suite : public TestCommand +class Test_TC_SMOKECO_2_5Suite : public TestCommand { public: - Test_TC_SMCO_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_5", 75, credsIssuerConfig) + Test_TC_SMOKECO_2_5Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_5", 75, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -62993,7 +63001,7 @@ class Test_TC_SMCO_2_5Suite : public TestCommand AddArgument("EVENT_NUMBER", 0, UINT64_MAX, &mEventNumber); } - ~Test_TC_SMCO_2_5Suite() {} + ~Test_TC_SMOKECO_2_5Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(6090)); } @@ -64452,10 +64460,11 @@ class Test_TC_SMCO_2_5Suite : public TestCommand } }; -class Test_TC_SMCO_2_6Suite : public TestCommand +class Test_TC_SMOKECO_2_6Suite : public TestCommand { public: - Test_TC_SMCO_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_SMCO_2_6", 34, credsIssuerConfig) + Test_TC_SMOKECO_2_6Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SMOKECO_2_6", 34, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -64474,9 +64483,13 @@ class Test_TC_SMCO_2_6Suite : public TestCommand AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarm); AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarmClear); AddArgument("HIEST_PRI_ALARM", 0, UINT8_MAX, &mHiestPriAlarm); + AddArgument("HIEST_PRI_ALARM_2", 0, UINT8_MAX, &mHiestPriAlarm2); + AddArgument("HIEST_PRI_ALARM_3", 0, UINT8_MAX, &mHiestPriAlarm3); + AddArgument("HIEST_PRI_ALARM_4", 0, UINT8_MAX, &mHiestPriAlarm4); + AddArgument("HIEST_PRI_ALARM_5", 0, UINT8_MAX, &mHiestPriAlarm5); } - ~Test_TC_SMCO_2_6Suite() {} + ~Test_TC_SMOKECO_2_6Suite() {} chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(3090)); } @@ -64497,6 +64510,10 @@ class Test_TC_SMCO_2_6Suite : public TestCommand chip::Optional mTestEventTriggerInterconnectCoAlarm; chip::Optional mTestEventTriggerInterconnectCoAlarmClear; chip::Optional mHiestPriAlarm; + chip::Optional mHiestPriAlarm2; + chip::Optional mHiestPriAlarm3; + chip::Optional mHiestPriAlarm4; + chip::Optional mHiestPriAlarm5; chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } @@ -64670,7 +64687,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand { chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm2.HasValue() ? mHiestPriAlarm2.Value() : 2U)); VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); } break; @@ -64692,7 +64709,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand { chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm3.HasValue() ? mHiestPriAlarm3.Value() : 7U)); VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); } break; @@ -64714,7 +64731,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand { chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm4.HasValue() ? mHiestPriAlarm4.Value() : 7U)); VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); } break; @@ -64736,7 +64753,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand { chip::app::Clusters::SmokeCoAlarm::ExpressedStateEnum value; VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); - VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + VerifyOrReturn(CheckValue("expressedState", value, mHiestPriAlarm5.HasValue() ? mHiestPriAlarm5.Value() : 3U)); VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); } break; @@ -64860,7 +64877,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " "Interconnect Smoke Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; value.enableKey = mTestEventTriggerKey.HasValue() @@ -64885,7 +64902,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " "Interconnect CO Alarm Test Event"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; value.enableKey = mTestEventTriggerKey.HasValue() @@ -65023,7 +65040,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " "Interconnect CO Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; value.enableKey = mTestEventTriggerKey.HasValue() @@ -65054,7 +65071,7 @@ class Test_TC_SMCO_2_6Suite : public TestCommand "TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with EnableKey field set to " "PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for " "Interconnect Smoke Alarm Test Event Clear"); - VerifyOrDo(!ShouldSkip("DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + VerifyOrDo(!ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); ListFreer listFreer; chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type value; value.enableKey = mTestEventTriggerKey.HasValue() @@ -115248,6 +115265,236 @@ class Test_TC_G_2_1Suite : public TestCommand } }; +class TestActivatedCarbonFilterMonitoringSuite : public TestCommand +{ +public: + TestActivatedCarbonFilterMonitoringSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestActivatedCarbonFilterMonitoring", 2, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~TestActivatedCarbonFilterMonitoringSuite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::ActivatedCarbonFilterMonitoring::Structs::ReplacementProductStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 0)); + VerifyOrReturn( + CheckValue("replacementProductList[0].productIdentifierType", iter_0.GetValue().productIdentifierType, 0U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[0].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, + chip::CharSpan("111112222233", 12))); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 1)); + VerifyOrReturn( + CheckValue("replacementProductList[1].productIdentifierType", iter_0.GetValue().productIdentifierType, 1U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[1].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, chip::CharSpan("gtin8xxx", 8))); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 2)); + VerifyOrReturn( + CheckValue("replacementProductList[2].productIdentifierType", iter_0.GetValue().productIdentifierType, 2U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[2].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, + chip::CharSpan("4444455555666", 13))); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 3)); + VerifyOrReturn( + CheckValue("replacementProductList[3].productIdentifierType", iter_0.GetValue().productIdentifierType, 3U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[3].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, + chip::CharSpan("gtin14xxxxxxxx", 14))); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 4)); + VerifyOrReturn( + CheckValue("replacementProductList[4].productIdentifierType", iter_0.GetValue().productIdentifierType, 4U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[4].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, + chip::CharSpan("oem20xxxxxxxxxxxxxxx", 20))); + VerifyOrReturn(CheckNoMoreListItems("replacementProductList", iter_0, 5)); + } + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read Replacement Product List"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::ReplacementProductList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class TestHepaFilterMonitoringSuite : public TestCommand +{ +public: + TestHepaFilterMonitoringSuite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("TestHepaFilterMonitoring", 2, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~TestHepaFilterMonitoringSuite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList< + chip::app::Clusters::HepaFilterMonitoring::Structs::ReplacementProductStruct::DecodableType> + value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 0)); + VerifyOrReturn( + CheckValue("replacementProductList[0].productIdentifierType", iter_0.GetValue().productIdentifierType, 0U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[0].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, + chip::CharSpan("111112222233", 12))); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 1)); + VerifyOrReturn( + CheckValue("replacementProductList[1].productIdentifierType", iter_0.GetValue().productIdentifierType, 1U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[1].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, chip::CharSpan("gtin8xxx", 8))); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 2)); + VerifyOrReturn( + CheckValue("replacementProductList[2].productIdentifierType", iter_0.GetValue().productIdentifierType, 2U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[2].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, + chip::CharSpan("4444455555666", 13))); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 3)); + VerifyOrReturn( + CheckValue("replacementProductList[3].productIdentifierType", iter_0.GetValue().productIdentifierType, 3U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[3].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, + chip::CharSpan("gtin14xxxxxxxx", 14))); + VerifyOrReturn(CheckNextListItemDecodes("replacementProductList", iter_0, 4)); + VerifyOrReturn( + CheckValue("replacementProductList[4].productIdentifierType", iter_0.GetValue().productIdentifierType, 4U)); + VerifyOrReturn(CheckValueAsString("replacementProductList[4].productIdentifierValue", + iter_0.GetValue().productIdentifierValue, + chip::CharSpan("oem20xxxxxxxxxxxxxxx", 20))); + VerifyOrReturn(CheckNoMoreListItems("replacementProductList", iter_0, 5)); + } + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read Replacement Product List"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::ReplacementProductList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + class Test_TC_ACFREMON_1_1Suite : public TestCommand { public: @@ -146585,13 +146832,13 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), @@ -146698,6 +146945,8 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index 6dfcc2f4741171..29072edb69e73f 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -192,6 +192,9 @@ class TestList : public Command { printf("Test_TC_PCC_2_4\n"); printf("Test_TC_RH_1_1\n"); printf("Test_TC_RH_2_1\n"); + printf("Test_TC_SMOKECO_1_1\n"); + printf("Test_TC_SMOKECO_2_1\n"); + printf("Test_TC_SMOKECO_2_6\n"); printf("Test_TC_SWTCH_1_1\n"); printf("Test_TC_TMP_1_1\n"); printf("Test_TC_TMP_2_1\n"); @@ -286,6 +289,8 @@ class TestList : public Command { printf("TestGroupsCluster\n"); printf("TestGroupKeyManagementCluster\n"); printf("Test_TC_G_1_1\n"); + printf("TestActivatedCarbonFilterMonitoring\n"); + printf("TestHepaFilterMonitoring\n"); printf("Test_TC_ACFREMON_1_1\n"); printf("Test_TC_ACFREMON_2_1\n"); printf("Test_TC_HEPAFREMON_1_1\n"); @@ -89913,6 +89918,2850 @@ class Test_TC_RH_2_1 : public TestCommandBridge { } }; +class Test_TC_SMOKECO_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_SMOKECO_1_1() + : TestCommandBridge("Test_TC_SMOKECO_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_SMOKECO_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SMOKECO_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SMOKECO_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 : Commission DUT to TH\n"); + err = TestCommissionDutToTh_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads the ClusterRevision attribute from the DUT\n"); + err = TestThReadsTheClusterRevisionAttributeFromTheDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the FeatureMap attribute\n"); + if (ShouldSkip("!SMOKECO.S.F00 && !SMOKECO.S.F01")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheFeatureMapAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the FeatureMap attribute(Smoke Alarm)\n"); + if (ShouldSkip("SMOKECO.S.F00 && !SMOKECO.S.F01")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheFeatureMapAttributeSmokeAlarm_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the FeatureMap attribute(CO Alarm)\n"); + if (ShouldSkip("SMOKECO.S.F01 && !SMOKECO.S.F00")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheFeatureMapAttributeCOAlarm_4(); + break; + case 5: + ChipLogProgress( + chipTool, " ***** Test Step 5 : TH reads from the DUT the FeatureMap attribute(Smoke Alarm & CO Alarm)\n"); + if (ShouldSkip("SMOKECO.S.F00 && SMOKECO.S.F01")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheFeatureMapAttributeSmokeAlarmCoAlarm_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the AttributeList attribute\n"); + err = TestThReadsFromTheDutTheAttributeListAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the AttributeList attribute(SmokeState)\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeSmokeState_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the AttributeList attribute(COState)\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeCOState_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the AttributeList attribute(DeviceMuted)\n"); + if (ShouldSkip("SMOKECO.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeDeviceMuted_9(); + break; + case 10: + ChipLogProgress( + chipTool, " ***** Test Step 10 : TH reads from the DUT the AttributeList attribute(InterconnectSmokeAlarm)\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeInterconnectSmokeAlarm_10(); + break; + case 11: + ChipLogProgress( + chipTool, " ***** Test Step 11 : TH reads from the DUT the AttributeList attribute(InterconnectCOAlarm)\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeInterconnectCOAlarm_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : TH reads from the DUT the AttributeList attribute(ContaminationState)\n"); + if (ShouldSkip("SMOKECO.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeContaminationState_12(); + break; + case 13: + ChipLogProgress( + chipTool, " ***** Test Step 13 : TH reads from the DUT the AttributeList attribute(SmokeSensitivityLevel)\n"); + if (ShouldSkip("SMOKECO.S.A000b")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeSmokeSensitivityLevel_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : TH reads from the DUT the AttributeList attribute(ExpiryDate)\n"); + if (ShouldSkip("SMOKECO.S.A000c")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAttributeListAttributeExpiryDate_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : TH reads from the DUT the EventList attribute\n"); + NextTest(); + return; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : TH reads from the DUT the EventList attribute(SmokeAlarm)\n"); + if (ShouldSkip("SMOKECO.S.E00")) { + NextTest(); + return; + } + NextTest(); + return; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : TH reads from the DUT the EventList attribute(COAlarm)\n"); + if (ShouldSkip("SMOKECO.S.E01")) { + NextTest(); + return; + } + NextTest(); + return; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : TH reads from the DUT the EventList attribute(AlarmMuted)\n"); + if (ShouldSkip("SMOKECO.S.E06")) { + NextTest(); + return; + } + NextTest(); + return; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : TH reads from the DUT the EventList attribute(MuteEnded)\n"); + if (ShouldSkip("SMOKECO.S.E07")) { + NextTest(); + return; + } + NextTest(); + return; + case 20: + ChipLogProgress( + chipTool, " ***** Test Step 20 : TH reads from the DUT the EventList attribute(InterconnectSmokeAlarm)\n"); + if (ShouldSkip("SMOKECO.S.E08")) { + NextTest(); + return; + } + NextTest(); + return; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : TH reads from the DUT the EventList attribute(InterconnectCOAlarm)\n"); + if (ShouldSkip("SMOKECO.S.E09")) { + NextTest(); + return; + } + NextTest(); + return; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : TH reads from the DUT the AcceptedCommandList attribute\n"); + if (ShouldSkip("!SMOKECO.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAcceptedCommandListAttribute_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : TH reads from the DUT the AcceptedCommandList attribute\n"); + if (ShouldSkip("SMOKECO.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheAcceptedCommandListAttribute_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : TH reads from the DUT the GeneratedCommandList attribute\n"); + err = TestThReadsFromTheDutTheGeneratedCommandListAttribute_24(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // 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 = 25; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestCommissionDutToTh_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsTheClusterRevisionAttributeFromTheDut_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads the ClusterRevision attribute from the DUT 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 TestThReadsFromTheDutTheFeatureMapAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the FeatureMap attribute 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 TestThReadsFromTheDutTheFeatureMapAttributeSmokeAlarm_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the FeatureMap attribute(Smoke Alarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 1UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheFeatureMapAttributeCOAlarm_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the FeatureMap attribute(CO Alarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 2UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheFeatureMapAttributeSmokeAlarmCoAlarm_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the FeatureMap attribute(Smoke Alarm & CO Alarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 3UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeSmokeState_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(SmokeState) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeCOState_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(COState) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeDeviceMuted_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(DeviceMuted) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeInterconnectSmokeAlarm_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(InterconnectSmokeAlarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeInterconnectCOAlarm_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(InterconnectCOAlarm) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeContaminationState_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(ContaminationState) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeSmokeSensitivityLevel_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(SmokeSensitivityLevel) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 11UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAttributeListAttributeExpiryDate_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AttributeList attribute(ExpiryDate) Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 12UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAcceptedCommandListAttribute_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AcceptedCommandList attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheAcceptedCommandListAttribute_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the AcceptedCommandList attribute 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 TestThReadsFromTheDutTheGeneratedCommandListAttribute_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the GeneratedCommandList attribute 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; + } +}; + +class Test_TC_SMOKECO_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_SMOKECO_2_1() + : TestCommandBridge("Test_TC_SMOKECO_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_SMOKECO_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SMOKECO_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SMOKECO_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 : Commission DUT to TH\n"); + err = TestCommissionDutToTh_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the ExpressedState attribute\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheExpressedStateAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the SmokeState attribute\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheSmokeStateAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the COState attribute\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheCOStateAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the BatteryAlert attribute\n"); + if (ShouldSkip("SMOKECO.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheBatteryAlertAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH reads from the DUT the DeviceMuted attribute\n"); + if (ShouldSkip("SMOKECO.S.A0004")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDeviceMutedAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH reads from the DUT the TestInProgress attribute\n"); + if (ShouldSkip("SMOKECO.S.A0005")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheTestInProgressAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH reads from the DUT the HardwareFaultAlert attribute\n"); + if (ShouldSkip("SMOKECO.S.A0006")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheHardwareFaultAlertAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TH reads from the DUT the EndOfServiceAlert attribute\n"); + if (ShouldSkip("SMOKECO.S.A0007")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheEndOfServiceAlertAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH reads from the DUT the InterconnectSmokeAlarm attribute\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInterconnectSmokeAlarmAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : TH reads from the DUT the InterconnectCOAlarm attribute\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInterconnectCOAlarmAttribute_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads from the DUT the ContaminationState attribute\n"); + if (ShouldSkip("SMOKECO.S.A000a")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheContaminationStateAttribute_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : TH reads from the DUT the SmokeSensitivityLevel attribute\n"); + if (ShouldSkip("SMOKECO.S.A000b")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheSmokeSensitivityLevelAttribute_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : TH reads from the DUT the ExpiryDate attribute\n"); + if (ShouldSkip("SMOKECO.S.A000c")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheExpiryDateAttribute_13(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // 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 = 14; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestCommissionDutToTh_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheExpressedStateAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ExpressedState attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("expressedState", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("expressedState", [value unsignedCharValue], 8U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheSmokeStateAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSmokeStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the SmokeState attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("smokeState", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("smokeState", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("smokeState", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheCOStateAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCOStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the COState attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("COState", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("COState", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("COState", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheBatteryAlertAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeBatteryAlertWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the BatteryAlert attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("batteryAlert", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("batteryAlert", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("batteryAlert", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDeviceMutedAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDeviceMutedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DeviceMuted attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("deviceMuted", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("deviceMuted", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("deviceMuted", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheTestInProgressAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeTestInProgressWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the TestInProgress attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("testInProgress", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheHardwareFaultAlertAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeHardwareFaultAlertWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the HardwareFaultAlert attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("hardwareFaultAlert", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheEndOfServiceAlertAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEndOfServiceAlertWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the EndOfServiceAlert attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("endOfServiceAlert", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("endOfServiceAlert", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("endOfServiceAlert", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInterconnectSmokeAlarmAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInterconnectSmokeAlarmWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InterconnectSmokeAlarm attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("interconnectSmokeAlarm", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("interconnectSmokeAlarm", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("interconnectSmokeAlarm", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInterconnectCOAlarmAttribute_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInterconnectCOAlarmWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InterconnectCOAlarm attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("interconnectCOAlarm", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("interconnectCOAlarm", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("interconnectCOAlarm", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheContaminationStateAttribute_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeContaminationStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ContaminationState attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("contaminationState", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("contaminationState", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("contaminationState", [value unsignedCharValue], 3U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheSmokeSensitivityLevelAttribute_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSmokeSensitivityLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the SmokeSensitivityLevel attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("smokeSensitivityLevel", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("smokeSensitivityLevel", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("smokeSensitivityLevel", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheExpiryDateAttribute_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpiryDateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ExpiryDate attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("expiryDate", "epoch_s", "epoch_s")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_SMOKECO_2_6 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_SMOKECO_2_6() + : TestCommandBridge("Test_TC_SMOKECO_2_6") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + AddArgument("TEST_EVENT_TRIGGER_KEY", &mTestEventTriggerKey); + AddArgument("TEST_EVENT_TRIGGER_WARNING_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningSmokeAlarm); + AddArgument("TEST_EVENT_TRIGGER_SMOKE_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerSmokeAlarmClear); + AddArgument("TEST_EVENT_TRIGGER_WARNING_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerWarningCoAlarm); + AddArgument("TEST_EVENT_TRIGGER_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerCoAlarmClear); + AddArgument("TEST_EVENT_TRIGGER_WARNING_BATTERY_ALERT", 0, UINT64_MAX, &mTestEventTriggerWarningBatteryAlert); + AddArgument("TEST_EVENT_TRIGGER_BATTERY_ALERT_CLEAR", 0, UINT64_MAX, &mTestEventTriggerBatteryAlertClear); + AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_SMOKE_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectSmokeAlarm); + AddArgument( + "TEST_EVENT_TRIGGER_INTERCONNECT_SMOKE_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerInterconnectSmokeAlarmClear); + AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarm); + AddArgument("TEST_EVENT_TRIGGER_INTERCONNECT_CO_ALARM_CLEAR", 0, UINT64_MAX, &mTestEventTriggerInterconnectCoAlarmClear); + AddArgument("HIEST_PRI_ALARM", 0, UINT8_MAX, &mHiestPriAlarm); + AddArgument("HIEST_PRI_ALARM_2", 0, UINT8_MAX, &mHiestPriAlarm2); + AddArgument("HIEST_PRI_ALARM_3", 0, UINT8_MAX, &mHiestPriAlarm3); + AddArgument("HIEST_PRI_ALARM_4", 0, UINT8_MAX, &mHiestPriAlarm4); + AddArgument("HIEST_PRI_ALARM_5", 0, UINT8_MAX, &mHiestPriAlarm5); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_SMOKECO_2_6() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SMOKECO_2_6\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SMOKECO_2_6\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Commission DUT to TH\n"); + err = TestCommissionDutToTh_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Report: TH subscribes to BatteryAlert attribute from DUT\n"); + err = TestReportThSubscribesToBatteryAlertAttributeFromDut_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH subscribes to BatteryAlert attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0003")) { + NextTest(); + return; + } + err = TestThSubscribesToBatteryAlertAttributeFromDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Report: TH subscribes to InterconnectSmokeAlarm attribute from DUT\n"); + err = TestReportThSubscribesToInterconnectSmokeAlarmAttributeFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : TH subscribes to InterconnectSmokeAlarm attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThSubscribesToInterconnectSmokeAlarmAttributeFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Report: TH subscribes to InterconnectCOAlarm attribute from DUT\n"); + err = TestReportThSubscribesToInterconnectCOAlarmAttributeFromDut_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : TH subscribes to InterconnectCOAlarm attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThSubscribesToInterconnectCOAlarmAttributeFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Report: TH subscribes to COState attribute from DUT\n"); + err = TestReportThSubscribesToCOStateAttributeFromDut_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TH subscribes to COState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThSubscribesToCOStateAttributeFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Report: TH subscribes to SmokeState attribute from DUT\n"); + err = TestReportThSubscribesToSmokeStateAttributeFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH subscribes to SmokeState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThSubscribesToSmokeStateAttributeFromDut_11(); + break; + case 12: + ChipLogProgress( + chipTool, " ***** Test Step 12 : TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster\n"); + if (ShouldSkip("DGGEN.S.A0008")) { + NextTest(); + return; + } + err = TestThReadsTestEventTriggersEnabledAttributeFromGeneralDiagnosticsCluster_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning Battery Alert Test Event\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningBatteryAlertTestEvent_13(); + break; + case 14: + ChipLogProgress(chipTool, + " ***** Test Step 14 : TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0003")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfBatteryAlertAttributeFromDutWithATimeoutOf300Seconds_14(); + break; + case 15: + ChipLogProgress(chipTool, + " ***** Test Step 15 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event\n"); + if (ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectSmokeAlarmTestEvent_15(); + break; + case 16: + ChipLogProgress(chipTool, + " ***** Test Step 16 : TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 " + "seconds\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfInterconnectSmokeAlarmAttributeFromDutWithATimeoutOf300Seconds_16(); + break; + case 17: + ChipLogProgress(chipTool, + " ***** Test Step 17 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event\n"); + if (ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectCoAlarmTestEvent_17(); + break; + case 18: + ChipLogProgress(chipTool, + " ***** Test Step 18 : TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 " + "seconds\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfInterconnectCOAlarmAttributeFromDutWithATimeoutOf300Seconds_18(); + break; + case 19: + ChipLogProgress(chipTool, + " ***** Test Step 19 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning CO Alarm Test Event\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningCoAlarmTestEvent_19(); + break; + case 20: + ChipLogProgress(chipTool, + " ***** Test Step 20 : TH waits for a report of COState attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfCOStateAttributeFromDutWithATimeoutOf300Seconds_20(); + break; + case 21: + ChipLogProgress(chipTool, + " ***** Test Step 21 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning Smoke Alarm Test Event\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningSmokeAlarmTestEvent_21(); + break; + case 22: + ChipLogProgress(chipTool, + " ***** Test Step 22 : TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfSmokeStateAttributeFromDutWithATimeoutOf300Seconds_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_23(); + break; + case 24: + ChipLogProgress(chipTool, + " ***** Test Step 24 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke Alarm Test Event Clear\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForSmokeAlarmTestEventClear_24(); + break; + case 25: + ChipLogProgress(chipTool, + " ***** Test Step 25 : TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0001")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfSmokeStateAttributeFromDutWithATimeoutOf300Seconds_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_26(); + break; + case 27: + ChipLogProgress(chipTool, + " ***** Test Step 27 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for CO Alarm Test Event clear\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForCoAlarmTestEventClear_27(); + break; + case 28: + ChipLogProgress(chipTool, + " ***** Test Step 28 : TH waits for a report of COState attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0002")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfCOStateAttributeFromDutWithATimeoutOf300Seconds_28(); + break; + case 29: + ChipLogProgress(chipTool, " ***** Test Step 29 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_29(); + break; + case 30: + ChipLogProgress(chipTool, + " ***** Test Step 30 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event Clear\n"); + if (ShouldSkip("SMOKECO.S.A0009 && DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectCoAlarmTestEventClear_30(); + break; + case 31: + ChipLogProgress(chipTool, + " ***** Test Step 31 : TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 " + "seconds\n"); + if (ShouldSkip("SMOKECO.S.A0009")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfInterconnectCOAlarmAttributeFromDutWithATimeoutOf300Seconds_31(); + break; + case 32: + ChipLogProgress(chipTool, " ***** Test Step 32 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_32(); + break; + case 33: + ChipLogProgress(chipTool, + " ***** Test Step 33 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event Clear\n"); + if (ShouldSkip("SMOKECO.S.A0008 && DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectSmokeAlarmTestEventClear_33(); + break; + case 34: + ChipLogProgress(chipTool, + " ***** Test Step 34 : TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 " + "seconds\n"); + if (ShouldSkip("SMOKECO.S.A0008")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfInterconnectSmokeAlarmAttributeFromDutWithATimeoutOf300Seconds_34(); + break; + case 35: + ChipLogProgress(chipTool, " ***** Test Step 35 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_35(); + break; + case 36: + ChipLogProgress(chipTool, + " ***** Test Step 36 : TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + "EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + "PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Battery Alert Test Event Clear\n"); + if (ShouldSkip("DGGEN.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForBatteryAlertTestEventClear_36(); + break; + case 37: + ChipLogProgress(chipTool, + " ***** Test Step 37 : TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds\n"); + if (ShouldSkip("SMOKECO.S.A0003")) { + NextTest(); + return; + } + err = TestThWaitsForAReportOfBatteryAlertAttributeFromDutWithATimeoutOf300Seconds_37(); + break; + case 38: + ChipLogProgress(chipTool, " ***** Test Step 38 : TH reads ExpressedState attribute from DUT\n"); + if (ShouldSkip("SMOKECO.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsExpressedStateAttributeFromDut_38(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 27: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 28: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 29: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 30: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 31: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 32: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 33: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 34: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 35: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 36: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 37: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 38: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(3090)); } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 39; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + chip::Optional mTestEventTriggerKey; + chip::Optional mTestEventTriggerWarningSmokeAlarm; + chip::Optional mTestEventTriggerSmokeAlarmClear; + chip::Optional mTestEventTriggerWarningCoAlarm; + chip::Optional mTestEventTriggerCoAlarmClear; + chip::Optional mTestEventTriggerWarningBatteryAlert; + chip::Optional mTestEventTriggerBatteryAlertClear; + chip::Optional mTestEventTriggerInterconnectSmokeAlarm; + chip::Optional mTestEventTriggerInterconnectSmokeAlarmClear; + chip::Optional mTestEventTriggerInterconnectCoAlarm; + chip::Optional mTestEventTriggerInterconnectCoAlarmClear; + chip::Optional mHiestPriAlarm; + chip::Optional mHiestPriAlarm2; + chip::Optional mHiestPriAlarm3; + chip::Optional mHiestPriAlarm4; + chip::Optional mHiestPriAlarm5; + + CHIP_ERROR TestCommissionDutToTh_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ExpressedState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_2_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToBatteryAlertAttributeFromDut_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to BatteryAlert attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("BatteryAlert", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("batteryAlert", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_2_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToBatteryAlertAttributeFromDut_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = true; + [cluster subscribeAttributeBatteryAlertWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn( + testSendClusterTest_TC_SMOKECO_2_6_2_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to BatteryAlert attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported; + test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_4_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToInterconnectSmokeAlarmAttributeFromDut_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to InterconnectSmokeAlarm attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("InterconnectSmokeAlarm", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("interconnectSmokeAlarm", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_4_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToInterconnectSmokeAlarmAttributeFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = false; + [cluster subscribeAttributeInterconnectSmokeAlarmWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn( + testSendClusterTest_TC_SMOKECO_2_6_4_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to InterconnectSmokeAlarm attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported; + test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_6_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToInterconnectCOAlarmAttributeFromDut_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to InterconnectCOAlarm attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("InterconnectCOAlarm", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("interconnectCOAlarm", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_6_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToInterconnectCOAlarmAttributeFromDut_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = false; + [cluster subscribeAttributeInterconnectCOAlarmWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn( + testSendClusterTest_TC_SMOKECO_2_6_6_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to InterconnectCOAlarm attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported; + test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_8_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_COState_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToCOStateAttributeFromDut_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_COState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to COState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("COState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("COState", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_8_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToCOStateAttributeFromDut_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = false; + [cluster subscribeAttributeCOStateWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn( + testSendClusterTest_TC_SMOKECO_2_6_8_WaitForReport_Fulfilled, SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to COState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_COState_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_COState_Reported; + test_Test_TC_SMOKECO_2_6_COState_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + bool testSendClusterTest_TC_SMOKECO_2_6_10_WaitForReport_Fulfilled = false; + ResponseHandler _Nullable test_Test_TC_SMOKECO_2_6_SmokeState_Reported = nil; + + CHIP_ERROR TestReportThSubscribesToSmokeStateAttributeFromDut_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_SmokeState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Report: TH subscribes to SmokeState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("SmokeState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("smokeState", "enum8", "enum8")); + testSendClusterTest_TC_SMOKECO_2_6_10_WaitForReport_Fulfilled = true; + }; + + NextTest(); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThSubscribesToSmokeStateAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + uint16_t minIntervalArgument = 3U; + uint16_t maxIntervalArgument = 30U; + __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(minIntervalArgument) + maxInterval:@(maxIntervalArgument)]; + params.filterByFabric = true; + params.replaceExistingSubscriptions = false; + [cluster subscribeAttributeSmokeStateWithParams:params + subscriptionEstablished:^{ + VerifyOrReturn(testSendClusterTest_TC_SMOKECO_2_6_10_WaitForReport_Fulfilled, + SetCommandExitStatus(CHIP_ERROR_INCORRECT_STATE)); + NextTest(); + } + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH subscribes to SmokeState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + if (test_Test_TC_SMOKECO_2_6_SmokeState_Reported != nil) { + ResponseHandler callback = test_Test_TC_SMOKECO_2_6_SmokeState_Reported; + test_Test_TC_SMOKECO_2_6_SmokeState_Reported = nil; + callback(value, err); + } + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsTestEventTriggersEnabledAttributeFromGeneralDiagnosticsCluster_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeTestEventTriggersEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads TestEventTriggersEnabled attribute from General Diagnostics Cluster Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("TestEventTriggersEnabled", actualValue, 1)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningBatteryAlertTestEvent_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerWarningBatteryAlert.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerWarningBatteryAlert.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000095ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning Battery Alert Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfBatteryAlertAttributeFromDutWithATimeoutOf300Seconds_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("BatteryAlert", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("batteryAlert", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectSmokeAlarmTestEvent_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerInterconnectSmokeAlarm.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerInterconnectSmokeAlarm.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000092ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfInterconnectSmokeAlarmAttributeFromDutWithATimeoutOf300Seconds_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog( + @"TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("interconnectSmokeAlarm", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("interconnectSmokeAlarm", [value unsignedCharValue], 1U)); + VerifyOrReturn(CheckConstraintMaxValue("interconnectSmokeAlarm", [value unsignedCharValue], 2U)); + + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectCoAlarmTestEvent_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerInterconnectCoAlarm.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerInterconnectCoAlarm.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000094ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfInterconnectCOAlarmAttributeFromDutWithATimeoutOf300Seconds_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("interconnectCOAlarm", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("interconnectCOAlarm", [value unsignedCharValue], 1U)); + VerifyOrReturn(CheckConstraintMaxValue("interconnectCOAlarm", [value unsignedCharValue], 2U)); + + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningCoAlarmTestEvent_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerWarningCoAlarm.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerWarningCoAlarm.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000091ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning CO Alarm Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfCOStateAttributeFromDutWithATimeoutOf300Seconds_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_COState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of COState attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("COState", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("COState", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForWarningSmokeAlarmTestEvent_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerWarningSmokeAlarm.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerWarningSmokeAlarm.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff00000090ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Warning Smoke Alarm Test Event Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfSmokeStateAttributeFromDutWithATimeoutOf300Seconds_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_SmokeState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("SmokeState", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("smokeState", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ExpressedState", actualValue, mHiestPriAlarm.HasValue() ? mHiestPriAlarm.Value() : 1U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForSmokeAlarmTestEventClear_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerSmokeAlarmClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerSmokeAlarmClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a0ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Smoke Alarm Test Event Clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfSmokeStateAttributeFromDutWithATimeoutOf300Seconds_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_SmokeState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of SmokeState attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("SmokeState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("smokeState", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn( + CheckValue("ExpressedState", actualValue, mHiestPriAlarm2.HasValue() ? mHiestPriAlarm2.Value() : 2U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForCoAlarmTestEventClear_27() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerCoAlarmClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerCoAlarmClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a1ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for CO Alarm Test Event clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfCOStateAttributeFromDutWithATimeoutOf300Seconds_28() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_COState_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of COState attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("COState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("COState", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_29() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn( + CheckValue("ExpressedState", actualValue, mHiestPriAlarm3.HasValue() ? mHiestPriAlarm3.Value() : 7U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectCoAlarmTestEventClear_30() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerInterconnectCoAlarmClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerInterconnectCoAlarmClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a4ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect CO Alarm Test Event Clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfInterconnectCOAlarmAttributeFromDutWithATimeoutOf300Seconds_31() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectCOAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of InterconnectCOAlarm attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("InterconnectCOAlarm", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("interconnectCOAlarm", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_32() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn( + CheckValue("ExpressedState", actualValue, mHiestPriAlarm4.HasValue() ? mHiestPriAlarm4.Value() : 7U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForInterconnectSmokeAlarmTestEventClear_33() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerInterconnectSmokeAlarmClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerInterconnectSmokeAlarmClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a2ULL]; + [cluster + testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field set to " + @"PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Interconnect Smoke Alarm Test Event Clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfInterconnectSmokeAlarmAttributeFromDutWithATimeoutOf300Seconds_34() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_InterconnectSmokeAlarm_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog( + @"TH waits for a report of InterconnectSmokeAlarm attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("InterconnectSmokeAlarm", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("interconnectSmokeAlarm", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_35() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn( + CheckValue("ExpressedState", actualValue, mHiestPriAlarm5.HasValue() ? mHiestPriAlarm5.Value() : 3U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR + TestThSendsTestEventTriggerCommandToGeneralDiagnosticsClusterOnEndpoint0WithEnableKeyFieldSetToPixitsmokecotestEventTriggerKeyAndEventTriggerFieldSetToPixitsmokecotestEventTriggerForBatteryAlertTestEventClear_36() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device + endpointID:@(0) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; + params.enableKey = mTestEventTriggerKey.HasValue() + ? [NSData dataWithBytes:mTestEventTriggerKey.Value().data() length:mTestEventTriggerKey.Value().size()] + : [[NSData alloc] initWithBytes:"\x00\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\xdd\xee\xff" length:16]; + params.eventTrigger = mTestEventTriggerBatteryAlertClear.HasValue() + ? [NSNumber numberWithUnsignedLongLong:mTestEventTriggerBatteryAlertClear.Value()] + : [NSNumber numberWithUnsignedLongLong:0xffffffff000000a5ULL]; + [cluster testEventTriggerWithParams:params + completion:^(NSError * _Nullable err) { + NSLog(@"TH sends TestEventTrigger command to General Diagnostics Cluster on Endpoint 0 with " + @"EnableKey field set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER_KEY and EventTrigger field " + @"set to PIXIT.SMOKECO.TEST_EVENT_TRIGGER for Battery Alert Test Event Clear Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThWaitsForAReportOfBatteryAlertAttributeFromDutWithATimeoutOf300Seconds_37() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + test_Test_TC_SMOKECO_2_6_BatteryAlert_Reported = ^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH waits for a report of BatteryAlert attribute from DUT with a timeout of 300 seconds Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("BatteryAlert", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("batteryAlert", "enum8", "enum8")); + NextTest(); + }; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsExpressedStateAttributeFromDut_38() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads ExpressedState attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ExpressedState", actualValue, 0U)); + } + + VerifyOrReturn(CheckConstraintType("expressedState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_SWTCH_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -175607,6 +178456,295 @@ class Test_TC_G_1_1 : public TestCommandBridge { } }; +class TestActivatedCarbonFilterMonitoring : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + TestActivatedCarbonFilterMonitoring() + : TestCommandBridge("TestActivatedCarbonFilterMonitoring") + , 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) + + ~TestActivatedCarbonFilterMonitoring() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: TestActivatedCarbonFilterMonitoring\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: TestActivatedCarbonFilterMonitoring\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 Replacement Product List\n"); + err = TestReadReplacementProductList_1(); + 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; + } + + // 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 = 2; + + 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 TestReadReplacementProductList_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeReplacementProductListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read Replacement Product List Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ReplacementProductList", [actualValue count], static_cast(5))); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[0]).productIdentifierType, + 0U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[0]).productIdentifierValue, + @"111112222233")); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[1]).productIdentifierType, + 1U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[1]).productIdentifierValue, + @"gtin8xxx")); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[2]).productIdentifierType, + 2U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[2]).productIdentifierValue, + @"4444455555666")); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[3]).productIdentifierType, + 3U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[3]).productIdentifierValue, + @"gtin14xxxxxxxx")); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[4]).productIdentifierType, + 4U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRActivatedCarbonFilterMonitoringClusterReplacementProductStruct *) actualValue[4]).productIdentifierValue, + @"oem20xxxxxxxxxxxxxxx")); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class TestHepaFilterMonitoring : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + TestHepaFilterMonitoring() + : TestCommandBridge("TestHepaFilterMonitoring") + , 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) + + ~TestHepaFilterMonitoring() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: TestHepaFilterMonitoring\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: TestHepaFilterMonitoring\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 Replacement Product List\n"); + err = TestReadReplacementProductList_1(); + 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; + } + + // 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 = 2; + + 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 TestReadReplacementProductList_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeReplacementProductListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read Replacement Product List Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ReplacementProductList", [actualValue count], static_cast(5))); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[0]).productIdentifierType, 0U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[0]).productIdentifierValue, + @"111112222233")); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[1]).productIdentifierType, 1U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[1]).productIdentifierValue, + @"gtin8xxx")); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[2]).productIdentifierType, 2U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[2]).productIdentifierValue, + @"4444455555666")); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[3]).productIdentifierType, 3U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[3]).productIdentifierValue, + @"gtin14xxxxxxxx")); + VerifyOrReturn(CheckValue("ProductIdentifierType", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[4]).productIdentifierType, 4U)); + VerifyOrReturn(CheckValueAsString("ProductIdentifierValue", + ((MTRHEPAFilterMonitoringClusterReplacementProductStruct *) actualValue[4]).productIdentifierValue, + @"oem20xxxxxxxxxxxxxxx")); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_ACFREMON_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -177382,6 +180520,9 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), @@ -177476,6 +180617,8 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),